check for deleted user on refresh

This commit is contained in:
Blake Blackshear 2024-05-12 09:51:24 -05:00
parent 58ae223371
commit 1284704293

View File

@ -183,6 +183,11 @@ def auth():
# if the jwt cookie is expiring soon
elif jwt_source == "cookie" and expiration - JWT_REFRESH <= current_time:
logger.debug("jwt token expiring soon, refreshing cookie")
# ensure the user hasn't been deleted
try:
User.get_by_id(user).execute()
except DoesNotExist:
return fail_response
new_expiration = current_time + JWT_SESSION_LENGTH
new_encoded_jwt = create_encoded_jwt(
user, new_expiration, current_app.jwt_token