summaryrefslogtreecommitdiff
path: root/src/leap/gui
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-03-11 17:03:00 -0300
committerTomás Touceda <chiiph@leap.se>2013-03-11 17:03:00 -0300
commit815315bdfb26aaee16a8482f1708bf3868019fd6 (patch)
treef8530233749ba62ca474385b34d6b1449523f3dd /src/leap/gui
parent51624331cdc592c322eb8ab2aad8c0e889cca0bf (diff)
Add user regex validator
Diffstat (limited to 'src/leap/gui')
-rw-r--r--src/leap/gui/wizard.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/leap/gui/wizard.py b/src/leap/gui/wizard.py
index f8a1f833..ef4eafdb 100644
--- a/src/leap/gui/wizard.py
+++ b/src/leap/gui/wizard.py
@@ -49,6 +49,8 @@ class Wizard(QtGui.QWizard):
WEAK_PASSWORDS = ("123456", "qweasd", "qwerty",
"password")
+ BARE_USERNAME_REGEX = r"^[A-Za-z\d_]+$"
+
def __init__(self, checker):
QtGui.QWizard.__init__(self)
@@ -110,6 +112,10 @@ class Wizard(QtGui.QWizard):
self.ui.btnRegister.clicked.connect(
self._register)
+ usernameRe = QtCore.QRegExp(self.BARE_USERNAME_REGEX)
+ self.ui.lblUser.setValidator(
+ QtGui.QRegExpValidator(usernameRe, self))
+
self._username = None
self._password = None