Skip to content

Commit

Permalink
Actually add API key to email /login route
Browse files Browse the repository at this point in the history
  • Loading branch information
chennisden committed Aug 12, 2024
1 parent dc6784b commit df02b19
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions store/app/routers/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from store.app.routers.auth.github import github_auth_router
from store.app.utils.email import send_delete_email
from store.app.utils.password import verify_password
from store.utils import new_uuid

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -232,9 +231,13 @@ async def login_user(data: LoginRequest, user_crud: UserCrud = Depends()) -> Log
if user.hashed_password is None or not verify_password(data.password, user.hashed_password):
raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail="Invalid email or password")

token = new_uuid()
api_key = await user_crud.add_api_key(
user.id,
source="oauth",
permissions="full",
)

return LoginResponse(user_id=user.id, token=token)
return LoginResponse(user_id=user.id, token=api_key.id)


@users_router.get("/batch", response_model=PublicUserInfoResponse)
Expand Down

0 comments on commit df02b19

Please sign in to comment.