From 80c2be610ba4e2c4b6e7dda329f060d0daa54788 Mon Sep 17 00:00:00 2001 From: Robin Sonnabend <robin@fsmpi.rwth-aachen.de> Date: Thu, 12 Apr 2018 10:06:32 +0200 Subject: [PATCH] Remove ambiguity if the user is logged in or None --- shared.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shared.py b/shared.py index 585bc2f..6245705 100644 --- a/shared.py +++ b/shared.py @@ -136,11 +136,13 @@ security_manager = SecurityManager(config.SECURITY_KEY, max_duration) def check_login(): - return "auth" in session and security_manager.check_user(session["auth"]) + return current_user() is not None def current_user(): - if not check_login(): + if "auth" not in session: + return None + if not security_manager.check_user(session["auth"]): return None return User.from_hashstring(session["auth"]) -- GitLab