From 354f5df2b92f61a7c79e22ca5a44f67456f03b31 Mon Sep 17 00:00:00 2001
From: FSMPI Admin-Team <admin@fsmpi.rwth-aachen.de>
Date: Fri, 28 Apr 2017 16:02:02 +0200
Subject: [PATCH] Fix login after session format change

---
 auth.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/auth.py b/auth.py
index 87b4d64..42a5f4c 100644
--- a/auth.py
+++ b/auth.py
@@ -161,7 +161,10 @@ class SecurityManager:
         summary, hash = map(lambda s: s.encode("utf-8"), parts)
         maccer = self.maccer.copy()
         maccer.update(summary)
-        session_duration = datetime.now() - User.from_hashstring(string).timestamp
+        user = User.from_hashstring(string)
+        if user is None:
+            return False
+        session_duration = datetime.now() - user.timestamp
         macs_equal = hmac.compare_digest(maccer.hexdigest().encode("utf-8"), hash)
         time_short = int(session_duration.total_seconds()) < self.max_duration 
         return macs_equal and time_short
-- 
GitLab