From 18e5cd47477ebf5d2fe6b4370b5daea255eb5f4c Mon Sep 17 00:00:00 2001 From: bniwredyc Date: Thu, 13 Jul 2023 16:58:22 +0200 Subject: [PATCH] checks enabled --- CHECKS.disabled => CHECKS | 0 auth/authenticate.py | 8 ++++---- 2 files changed, 4 insertions(+), 4 deletions(-) rename CHECKS.disabled => CHECKS (100%) diff --git a/CHECKS.disabled b/CHECKS similarity index 100% rename from CHECKS.disabled rename to CHECKS diff --git a/auth/authenticate.py b/auth/authenticate.py index 770ac1cf..be4db2d2 100644 --- a/auth/authenticate.py +++ b/auth/authenticate.py @@ -27,12 +27,12 @@ class JWTAuthenticate(AuthenticationBackend): if not token: print("[auth.authenticate] no token in header %s" % SESSION_TOKEN_HEADER) return AuthCredentials(scopes={}, error_message=str("no token")), AuthUser( - user_id=None + user_id=None, username='' ) if len(token.split('.')) > 1: payload = await SessionToken.verify(token) - user = None + with local_session() as session: try: user = ( @@ -52,12 +52,12 @@ class JWTAuthenticate(AuthenticationBackend): scopes=scopes, logged_in=True ), - AuthUser(user_id=user.id), + AuthUser(user_id=user.id, username=''), ) except exc.NoResultFound: pass - return AuthCredentials(scopes={}, error_message=str('Invalid token')), AuthUser(user_id=None) + return AuthCredentials(scopes={}, error_message=str('Invalid token')), AuthUser(user_id=None, username='') def login_required(func):