diff options
author | kali <kali@leap.se> | 2013-03-26 01:15:44 +0900 |
---|---|---|
committer | kali <kali@leap.se> | 2013-03-26 01:15:44 +0900 |
commit | d193fee401d606f6120ac11819a0127e7ee92458 (patch) | |
tree | 74bac3ea56f3543f77dfa708df0f35b6a2922bd8 /src/leap/crypto/srpregister.py | |
parent | 18b806806fcf508126b86fe84dce9ecaae98fc47 (diff) |
tests for srpregister and srpauth
in this commit too, the twisted fake_provider implementation
Diffstat (limited to 'src/leap/crypto/srpregister.py')
-rw-r--r-- | src/leap/crypto/srpregister.py | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/leap/crypto/srpregister.py b/src/leap/crypto/srpregister.py index 9a9cac76..dc137aeb 100644 --- a/src/leap/crypto/srpregister.py +++ b/src/leap/crypto/srpregister.py @@ -55,7 +55,7 @@ class SRPRegister(QtCore.QObject): @type register_path; str """ QtCore.QObject.__init__(self) - leap_assert(provider_config, "Please provider a provider") + leap_assert(provider_config, "Please provide a provider") leap_assert_type(provider_config, ProviderConfig) self._provider_config = provider_config @@ -125,15 +125,24 @@ class SRPRegister(QtCore.QObject): logger.debug("Will try to register user = %s" % (username,)) logger.debug("user_data => %r" % (user_data,)) - req = self._session.post(uri, - data=user_data, - timeout=SIGNUP_TIMEOUT, - verify=self._provider_config. - get_ca_cert_path()) + try: + req = self._session.post(uri, + data=user_data, + timeout=SIGNUP_TIMEOUT, + verify=self._provider_config. + get_ca_cert_path()) - self.registration_finished.emit(req.ok, req) + except requests.exceptions.SSLError as exc: + logger.error("SSLError: %s" % exc.message) + _ok = False + req = None - return req.ok + else: + _ok = req.ok + + self.registration_finished.emit(_ok, req) + + return _ok if __name__ == "__main__": |