From 3a0603cb7b5aee2f0b950541dcad4a14c7f556ea Mon Sep 17 00:00:00 2001 From: Loic Baron Date: Wed, 22 Apr 2015 19:40:24 +0200 Subject: [PATCH] Session: avoid error --- localauth/manifoldbackend.py | 4 ++-- portal/homeview.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/localauth/manifoldbackend.py b/localauth/manifoldbackend.py index 74511a10..504a85be 100644 --- a/localauth/manifoldbackend.py +++ b/localauth/manifoldbackend.py @@ -33,7 +33,7 @@ class ManifoldBackend: sessions = sessions_result.ok_value() if not sessions: logger.error("GetSession failed: {}".format(sessions_result.error())) - return + return None session = sessions[0] logger.debug("SESSION : {}".format(session.keys())) @@ -48,7 +48,7 @@ class ManifoldBackend: persons = persons_result.ok_value() if not persons: logger.error("GetPersons failed: {}".format(persons_result.error())) - return + return None person = persons[0] logger.debug("PERSON : {}".format(person)) diff --git a/portal/homeview.py b/portal/homeview.py index 5fea636b..a6135328 100644 --- a/portal/homeview.py +++ b/portal/homeview.py @@ -60,7 +60,7 @@ class HomeView (FreeAccessView, ThemeView): # user was authenticated at the backend elif auth_result is not None: user=auth_result - if user.is_active: + if user is not None and user.is_active: login(request, user) if request.user.is_authenticated(): -- 2.43.0