This commit is contained in:
Joseph Schorr 2013-11-15 15:31:11 -05:00
commit 6a2b439863
4 changed files with 17 additions and 9 deletions

View file

@ -1,5 +1,4 @@
import re
import urllib
INVALID_PASSWORD_MESSAGE = 'Invalid password, password must be at least ' + \
'8 characters and contain no whitespace.'
@ -12,9 +11,9 @@ def validate_email(email_address):
def validate_username(username):
# Minimum length of 2, maximum length of 255, no url unsafe characters
return (urllib.quote(username, safe='') == username and
len(username) > 1 and
len(username) < 256)
return (re.search(r'[^a-z0-9_]', username) is None and
len(username) >= 4 and
len(username) <= 30)
def validate_password(password):