summaryrefslogtreecommitdiff
path: root/src/leap/crypto/srpregister.py
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-03-07 19:05:11 -0300
committerTomás Touceda <chiiph@leap.se>2013-03-07 19:05:11 -0300
commit751638b4eb8208e1eaa1beaaed284da6b412bca7 (patch)
tree58a517d1f22a45a581fcca3ff2766663974de3fa /src/leap/crypto/srpregister.py
parent6d6600a495ef48e0f04cb78bedca8fb913bada2a (diff)
Change asserts for a custom leap_assert method
Also: - Make SRPAuth and the Bootstrappers be a QObject instead of a QThread so we can use them inside another more generic thread - Add a generic CheckerThread that runs checks or whatever operation as long as it returns a boolean value - Closes the whole application if the wizard is rejected at the first run - Do not fail when the config directory doesn't exist - Set the wizard pixmap logo as LEAP's logo - Improve wizard checks - Make SRPRegister play nice with the CheckerThread
Diffstat (limited to 'src/leap/crypto/srpregister.py')
-rw-r--r--src/leap/crypto/srpregister.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/leap/crypto/srpregister.py b/src/leap/crypto/srpregister.py
index d9b2b22b..cf673e35 100644
--- a/src/leap/crypto/srpregister.py
+++ b/src/leap/crypto/srpregister.py
@@ -20,15 +20,17 @@ import binascii
import srp
import logging
+from PySide import QtCore
from urlparse import urlparse
from leap.config.providerconfig import ProviderConfig
from leap.crypto.constants import SIGNUP_TIMEOUT
+from leap.util.check import leap_assert, leap_assert_type
logger = logging.getLogger(__name__)
-class SRPRegister(object):
+class SRPRegister(QtCore.QObject):
"""
Registers a user to a specific provider using SRP
"""
@@ -37,6 +39,8 @@ class SRPRegister(object):
USER_VERIFIER_KEY = 'user[password_verifier]'
USER_SALT_KEY = 'user[password_salt]'
+ registration_finished = QtCore.Signal(bool, object)
+
def __init__(self,
provider_config=None,
register_path="users"):
@@ -49,10 +53,9 @@ class SRPRegister(object):
@param register_path: webapp path for registering users
@type register_path; str
"""
-
- assert provider_config, "Please provider a provider"
- assert isinstance(provider_config, ProviderConfig), \
- "We need a ProviderConfig instead of %r" % (provider_config,)
+ QtCore.QObject.__init__(self)
+ leap_assert(provider_config, "Please provider a provider")
+ leap_assert_type(provider_config, ProviderConfig)
self._provider_config = provider_config
@@ -131,7 +134,9 @@ class SRPRegister(object):
verify=self._provider_config.
get_ca_cert_path())
- return (req.ok, req)
+ self.registration_finished.emit(req.ok, req)
+
+ return req.ok
if __name__ == "__main__":