From 5aeaa69f5ffde88393c432752b62879b477e6e69 Mon Sep 17 00:00:00 2001 From: Leo Hemsted Date: Thu, 23 Feb 2017 16:38:18 +0000 Subject: [PATCH] fix logged_in_elsewhere to work when user never logged in before (new accounts) --- app/notify_client/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/notify_client/models.py b/app/notify_client/models.py index e2c8bd23d..e9fc8209b 100644 --- a/app/notify_client/models.py +++ b/app/notify_client/models.py @@ -20,7 +20,8 @@ class User(UserMixin): return self.id def logged_in_elsewhere(self): - return session.get('current_session_id') != self.current_session_id + # if the current user (ie: db object) has no session, they've never logged in before + return self.current_session_id is not None and session.get('current_session_id') != self.current_session_id @property def is_active(self):