diff options
-rw-r--r-- | src/leap/bitmask/backend.py | 3 | ||||
-rw-r--r-- | src/leap/bitmask/crypto/srpauth.py | 18 |
2 files changed, 15 insertions, 6 deletions
diff --git a/src/leap/bitmask/backend.py b/src/leap/bitmask/backend.py index ff49908f..d208a6cd 100644 --- a/src/leap/bitmask/backend.py +++ b/src/leap/bitmask/backend.py @@ -546,7 +546,8 @@ class Authenticate(object): :rtype: bool """ - return self._srp_auth.is_authenticated() + return (self._srp_auth is not None and + self._srp_auth.is_authenticated()) def get_logged_in_status(self): """ diff --git a/src/leap/bitmask/crypto/srpauth.py b/src/leap/bitmask/crypto/srpauth.py index 895ab87e..192a9d5c 100644 --- a/src/leap/bitmask/crypto/srpauth.py +++ b/src/leap/bitmask/crypto/srpauth.py @@ -687,6 +687,18 @@ class SRPAuth(object): with self._token_lock: return self._token + def is_authenticated(self): + """ + Return whether the user is authenticated or not. + + :rtype: bool + """ + user = self._srp_user + if user is not None: + return user.authenticated() + + return False + __instance = None def __init__(self, provider_config, signaler=None): @@ -735,11 +747,7 @@ class SRPAuth(object): :rtype: bool """ - user = self.__instance._srp_user - if user is not None: - return self.__instance.authenticated() - - return False + return self.__instance.is_authenticated() def change_password(self, current_password, new_password): """ |