provide a better error message when creating a user account with non-ASCII characters

This commit is contained in:
Joshua Tauberer 2015-03-22 12:33:06 +00:00
parent dcd971d079
commit 01f2451349
1 changed files with 3 additions and 1 deletions

View File

@ -261,8 +261,10 @@ def add_mail_user(email, pw, privs, env):
# validate email
if email.strip() == "":
return ("No email address provided.", 400)
if not validate_email(email, mode='user'):
elif not validate_email(email):
return ("Invalid email address.", 400)
elif not validate_email(email, mode='user'):
return ("User account email addresses may only use the ASCII letters A-Z, the digits 0-9, underscore (_), hyphen (-), and period (.).", 400)
validate_password(pw)