Skip to content

Commit

Permalink
correct database session variable
Browse files Browse the repository at this point in the history
  • Loading branch information
cofin committed Oct 6, 2022
1 parent 634375c commit d1687ef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/server/app/web/routes/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ async def login(
) -> schemas.User:
# we have a user instance - probably by retrieving it from persistence using another lib.
# what's important for our purposes is to have an identifier:
user = await services.user.authenticate(db, data.username, data.password)
user = await services.user.authenticate(db_session, data.username, data.password)
request.set_session({"user_id": user.id})
logger.info(f"authenticated user: {user.email}")
return schemas.User.from_orm(user)


@post(path=urls.SIGNUP, tags=["Access"])
async def signup(db_session: AsyncSession, request: Request, data: schemas.UserSignup) -> schemas.User:
user = await services.user.create(db, data)
user = await services.user.create(db_session, data)
request.set_session({"user_id": user.id})
return schemas.User.from_orm(user)

0 comments on commit d1687ef

Please sign in to comment.