From: Loic Baron Date: Wed, 22 Apr 2015 17:40:24 +0000 (+0200) Subject: Session: avoid error X-Git-Tag: myslice-1.3~24 X-Git-Url: http://git.onelab.eu/?p=myslice.git;a=commitdiff_plain;h=3a0603cb7b5aee2f0b950541dcad4a14c7f556ea Session: avoid error --- 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():