diff options
author | kali <kali@leap.se> | 2012-10-08 03:50:07 +0900 |
---|---|---|
committer | kali <kali@leap.se> | 2012-10-08 03:50:07 +0900 |
commit | 9b025fe9972f686e40481d5eb03518e2fdac2d14 (patch) | |
tree | a919381613d4b6a58c80833cb126eca1b06bd1bb | |
parent | f60e4bbbad22d6ae2d40abfc6f47eba1d0d7cbc8 (diff) |
fix hexlify + add regex validator for usernames
-rwxr-xr-x | src/leap/gui/firstrunwizard.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/leap/gui/firstrunwizard.py b/src/leap/gui/firstrunwizard.py index d1fb77ec..27cc01aa 100755 --- a/src/leap/gui/firstrunwizard.py +++ b/src/leap/gui/firstrunwizard.py @@ -17,6 +17,7 @@ APP_LOGO = ':/images/leap-color-small.png' # registration ###################### # move to base/ +import binascii import requests import srp @@ -76,8 +77,8 @@ class LeapSRPRegister(object): user_data = { 'user[login]': username, - 'user[password_verifier]': vkey, - 'user[password_salt]': salt} + 'user[password_verifier]': binascii.hexlify(vkey), + 'user[password_salt]': binascii.hexlify(salt)} uri = self.get_registration_uri() logger.debug('post to uri: %s' % uri) @@ -87,6 +88,7 @@ class LeapSRPRegister(object): logger.debug(req) logger.debug('user_data: %s', user_data) #logger.debug('response: %s', req.text) + # we catch it in the form req.raise_for_status() return True @@ -271,11 +273,11 @@ class RegisterUserPage(QtGui.QWizardPage): userNameLineEdit.cursorPositionChanged.connect( self.reset_validation_status) userNameLabel.setBuddy(userNameLineEdit) - # TODO - # add validator - # usernameRe = QRegexp(r"[]") - # userNameLineEdit.setValidator( - # QRegExpValidator(usernameRe, self)) + + # add regex validator + usernameRe = QtCore.QRegExp(r"^[A-Za-z\d_]+$") + userNameLineEdit.setValidator( + QtGui.QRegExpValidator(usernameRe, self)) self.userNameLineEdit = userNameLineEdit userPasswordLabel = QtGui.QLabel("&Password:") |