Fix #1096 - allow - in usernames

Signed-off-by: Loic Dachary <loic@dachary.org>
This commit is contained in:
Loic Dachary
2016-01-12 18:39:28 +01:00
committed by Christopher Allan Webber
parent 2fdc14a242
commit bbe0855651
2 changed files with 25 additions and 3 deletions

View File

@@ -57,7 +57,7 @@ def normalize_user_or_email_field(allow_email=True, allow_user=True):
if not allow_user:
raise wtforms.ValidationError(nouser_msg)
wtforms.validators.Length(min=3, max=30)(form, field)
wtforms.validators.Regexp(r'^\w+$')(form, field)
wtforms.validators.Regexp(r'^[-_\w]+$')(form, field)
field.data = field.data.lower()
if field.data is None: # should not happen, but be cautious anyway
raise wtforms.ValidationError(message)