Update code in endpoints/logout.post.py
This commit is contained in:
parent
19901ea6b5
commit
c6c867cdc2
@ -9,16 +9,15 @@ async def logout_handler(
|
||||
db: Session = Depends(get_db)
|
||||
):
|
||||
"""Demo logout endpoint"""
|
||||
user = get_user_from_token(token, db)
|
||||
user = get_user_from_token(token, fake_users_db)
|
||||
if not user:
|
||||
raise HTTPException(status_code=401, detail="Invalid authentication credentials")
|
||||
|
||||
# Invalidate token or remove user session
|
||||
invalidate_token(token)
|
||||
# Invalidate token or update user session
|
||||
revoke_token(token)
|
||||
user["active_session"] = None
|
||||
|
||||
return {
|
||||
"message": "Logout successful",
|
||||
"next_steps": [
|
||||
"Redirect to login page"
|
||||
]
|
||||
"user_id": user["id"]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user