Update code in endpoints/login.post.py
This commit is contained in:
parent
255f477466
commit
b9f7f23962
@ -13,7 +13,6 @@ async def login(
|
|||||||
db: Session = Depends(get_db)
|
db: Session = Depends(get_db)
|
||||||
):
|
):
|
||||||
user = authenticate_user(db, user_credentials.email, user_credentials.password)
|
user = authenticate_user(db, user_credentials.email, user_credentials.password)
|
||||||
|
|
||||||
if not user:
|
if not user:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||||
@ -22,9 +21,4 @@ async def login(
|
|||||||
)
|
)
|
||||||
|
|
||||||
access_token = create_access_token(data={"sub": user.email})
|
access_token = create_access_token(data={"sub": user.email})
|
||||||
|
return {"access_token": access_token, "token_type": "bearer", "user": user}
|
||||||
return {
|
|
||||||
"access_token": access_token,
|
|
||||||
"token_type": "bearer",
|
|
||||||
"user": user
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user