summaryrefslogtreecommitdiff
path: root/src/leap/gui
diff options
context:
space:
mode:
authorkali <kali@leap.se>2012-10-08 03:50:07 +0900
committerkali <kali@leap.se>2012-10-08 03:50:07 +0900
commit9b025fe9972f686e40481d5eb03518e2fdac2d14 (patch)
treea919381613d4b6a58c80833cb126eca1b06bd1bb /src/leap/gui
parentf60e4bbbad22d6ae2d40abfc6f47eba1d0d7cbc8 (diff)
fix hexlify + add regex validator for usernames
Diffstat (limited to 'src/leap/gui')
-rwxr-xr-xsrc/leap/gui/firstrunwizard.py16
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:")