summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2013-08-05 12:49:06 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2013-08-05 12:49:06 -0300
commit733ebec5f654580b4ed9cbcd767480b2f2c92984 (patch)
tree5ef685df9540016df730ad3c6483da8529c062dd /src
parent1170527c76d493858097ae58824b6e8f23c21a4c (diff)
parente02ed2ea8ebaeca4db9a04dc1c3d70d06d20f49f (diff)
Merge remote-tracking branch 'chiiph/bug/3214_regex_username' into develop
Diffstat (limited to 'src')
-rw-r--r--src/leap/gui/login.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/leap/gui/login.py b/src/leap/gui/login.py
index 3eb1fe39..3c994597 100644
--- a/src/leap/gui/login.py
+++ b/src/leap/gui/login.py
@@ -44,6 +44,8 @@ class LoginWidget(QtGui.QWidget):
MAX_STATUS_WIDTH = 40
+ BARE_USERNAME_REGEX = r"^[A-Za-z\d_]+$"
+
def __init__(self, settings, parent=None):
"""
Constructs the LoginWidget.
@@ -77,6 +79,10 @@ class LoginWidget(QtGui.QWidget):
self.ui.btnCreateAccount.clicked.connect(
self.show_wizard)
+ username_re = QtCore.QRegExp(self.BARE_USERNAME_REGEX)
+ self.ui.lnUser.setValidator(
+ QtGui.QRegExpValidator(username_re, self))
+
def _remember_state_changed(self, state):
"""
Saves the remember state in the LeapSettings
@@ -146,7 +152,7 @@ class LoginWidget(QtGui.QWidget):
def get_user(self):
"""
- Returns the user that appears in the widget
+ Returns the user that appears in the widget.
:rtype: str
"""