(form_data: Annotated[OAuth2PasswordRequestForm, Depends()])
| 76 | |
| 77 | @app.post("/token") |
| 78 | async def login(form_data: Annotated[OAuth2PasswordRequestForm, Depends()]): |
| 79 | user_dict = fake_users_db.get(form_data.username) |
| 80 | if not user_dict: |
| 81 | raise HTTPException(status_code=400, detail="Incorrect username or password") |
| 82 | user = UserInDB(**user_dict) |
| 83 | hashed_password = fake_hash_password(form_data.password) |
| 84 | if not hashed_password == user.hashed_password: |
| 85 | raise HTTPException(status_code=400, detail="Incorrect username or password") |
| 86 | |
| 87 | return {"access_token": user.username, "token_type": "bearer"} |
| 88 | |
| 89 | |
| 90 | @app.get("/users/me") |
nothing calls this directly
no test coverage detected
searching dependent graphs…