summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2014-04-16 12:21:38 -0300
committerTomás Touceda <chiiph@leap.se>2014-04-16 12:21:38 -0300
commit90bbab2d49446934c7dd5f8c3ec84fd937dcd0b1 (patch)
tree10a1332c32f7251a59097b1cd598d528569070e2
parent72aca6c71b08b27382d63297559f0fce7b9dfc1b (diff)
parenteece52ff0118af412b0e2bf7a4200ebf0bca2f16 (diff)
Merge remote-tracking branch 'refs/remotes/ivan/bug/fix-is_authenticated-method' into develop
-rw-r--r--src/leap/bitmask/backend.py3
-rw-r--r--src/leap/bitmask/crypto/srpauth.py18
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):
"""