diff options
author | Tomás Touceda <chiiph@leap.se> | 2013-06-12 10:57:20 -0300 |
---|---|---|
committer | Tomás Touceda <chiiph@leap.se> | 2013-06-12 10:57:20 -0300 |
commit | 1ede2af0afb6db2265d7e32428c197605e74589e (patch) | |
tree | 52faae7932ebb151a4f43dbcbacffcb94e9aa1e2 /src/leap/crypto/srpauth.py | |
parent | da018dfadc4f3c6cbd1613b45b339279aebb0589 (diff) |
Fix SRPAuth error reporting
Diffstat (limited to 'src/leap/crypto/srpauth.py')
-rw-r--r-- | src/leap/crypto/srpauth.py | 13 |
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,): |