summaryrefslogtreecommitdiff
path: root/src/leap/crypto/srpauth.py
diff options
context:
space:
mode:
authorkali <kali@leap.se>2013-06-13 01:50:14 +0900
committerkali <kali@leap.se>2013-06-13 01:50:14 +0900
commitf35506e9b93cf0182af37ccdcc36e343b44b882c (patch)
tree52faae7932ebb151a4f43dbcbacffcb94e9aa1e2 /src/leap/crypto/srpauth.py
parente46ef1d51d2b401bfeafd692e18158f787531459 (diff)
parent1ede2af0afb6db2265d7e32428c197605e74589e (diff)
Merge remote-tracking branch 'chiiph/feature/autostart_eip_rev1' into develop
Diffstat (limited to 'src/leap/crypto/srpauth.py')
-rw-r--r--src/leap/crypto/srpauth.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/leap/crypto/srpauth.py b/src/leap/crypto/srpauth.py
index 52267b3b..bcd24de3 100644
--- a/src/leap/crypto/srpauth.py
+++ b/src/leap/crypto/srpauth.py
@@ -241,10 +241,17 @@ class SRPAuth(QtCore.QObject):
raise SRPAuthenticationError("Bad JSON content in auth result")
if auth_result.status_code == 422:
+ error = ""
+ try:
+ error = json.loads(content).get("errors", "")
+ except ValueError:
+ logger.error("Problem parsing the received response: %s"
+ % (content,))
+ except AttributeError:
+ logger.error("Expecting a dict but something else was "
+ "received: %s", (content,))
logger.error("[%s] Wrong password (HAMK): [%s]" %
- (auth_result.status_code,
- content.
- get("errors", "")))
+ (auth_result.status_code, error))
raise SRPAuthenticationError(self.tr("Wrong password"))
if auth_result.status_code not in (200,):