From c6474d1870f0edab870659b80fb97bff85f901cd Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 21 Dec 2021 09:57:43 +0200 Subject: [PATCH] sfdsdf --- files/helpers/wrappers.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/files/helpers/wrappers.py b/files/helpers/wrappers.py index 02e1b3e90..4207b858e 100644 --- a/files/helpers/wrappers.py +++ b/files/helpers/wrappers.py @@ -4,10 +4,10 @@ from files.helpers.const import * def get_logged_in_user(): - token = request.headers.get("Authorization") + token = request.headers.get("Authorization","").strip() if token: - client = g.db.query(ClientAuth).filter(ClientAuth.access_token == token).first() + client = g.db.query(ClientAuth).filter(ClientAuth.access_token == token).one_or_none() if not client: return None v = client.user @@ -21,7 +21,7 @@ def get_logged_in_user(): if not uid or not logged_in or uid != logged_in: return None try: - if g.db: v = g.db.query(User).filter_by(id=uid).one_or_none() + if g.db: v = g.db.query(User).filter_by(id=logged_in).one_or_none() else: return None except: return None