diff options
author | kali <kali@leap.se> | 2012-10-06 02:30:34 +0900 |
---|---|---|
committer | kali <kali@leap.se> | 2012-10-06 02:30:34 +0900 |
commit | f60e4bbbad22d6ae2d40abfc6f47eba1d0d7cbc8 (patch) | |
tree | d3b47aff88f47ac3b47671c8c3003523352c1000 /src | |
parent | 0576427f697fa631d8f5cc2fc596c60bce38dda3 (diff) |
springbok hardcoded path for registration
Diffstat (limited to 'src')
-rw-r--r-- | src/leap/base/config.py | 1 | ||||
-rwxr-xr-x | src/leap/gui/firstrunwizard.py | 41 |
2 files changed, 29 insertions, 13 deletions
diff --git a/src/leap/base/config.py b/src/leap/base/config.py index dc047f80..57f9f1b7 100644 --- a/src/leap/base/config.py +++ b/src/leap/base/config.py @@ -149,6 +149,7 @@ class JSONLeapConfig(BaseLeapConfig): if not fetcher: fetcher = self.fetcher logger.debug('verify: %s', verify) + logger.debug('uri: %s', uri) request = fetcher.get(uri, verify=verify) # XXX should send a if-modified-since header diff --git a/src/leap/gui/firstrunwizard.py b/src/leap/gui/firstrunwizard.py index 02ace77e..d1fb77ec 100755 --- a/src/leap/gui/firstrunwizard.py +++ b/src/leap/gui/firstrunwizard.py @@ -28,7 +28,7 @@ class LeapSRPRegister(object): schema="https", provider=None, port=None, - register_path="users.json", + register_path="1/users.json", method="POST", fetcher=requests, srp=srp, @@ -53,11 +53,18 @@ class LeapSRPRegister(object): def get_registration_uri(self): # XXX assert is https! # use urlparse - uri = "%s://%s:%s/%s" % ( - self.schema, - self.provider, - self.port, - self.register_path) + if self.port: + uri = "%s://%s:%s/%s" % ( + self.schema, + self.provider, + self.port, + self.register_path) + else: + uri = "%s://%s/%s" % ( + self.schema, + self.provider, + self.register_path) + return uri def register_user(self, username, password, keep=False): @@ -68,9 +75,9 @@ class LeapSRPRegister(object): self.NG) user_data = { - 'login': username, - 'password_verifier': vkey, - 'password_salt': salt} + 'user[login]': username, + 'user[password_verifier]': vkey, + 'user[password_salt]': salt} uri = self.get_registration_uri() logger.debug('post to uri: %s' % uri) @@ -78,6 +85,8 @@ class LeapSRPRegister(object): # XXX get self.method req = self.session.post(uri, data=user_data) logger.debug(req) + logger.debug('user_data: %s', user_data) + #logger.debug('response: %s', req.text) req.raise_for_status() return True @@ -344,12 +353,14 @@ class RegisterUserPage(QtGui.QWizardPage): # XXX TODO -- remove debug info # XXX get from provider info + # XXX enforce https + # and pass a verify value signup = LeapSRPRegister( schema="http", - #provider="springbok" - provider="localhost", - port=8000 + #provider="localhost", + provider="springbok", + #port=8000 ) try: valid = signup.register_user(username, password) @@ -393,8 +404,12 @@ class LastPage(QtGui.QWizardPage): if __name__ == '__main__': - + # standalone test import sys + import logging + logging.basicConfig() + logger = logging.getLogger() + logger.setLevel(logging.DEBUG) app = QtGui.QApplication(sys.argv) wizard = FirstRunWizard() |