1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2024-11-26 02:57:04 +00:00

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

View File

@ -261,8 +261,10 @@ def add_mail_user(email, pw, privs, env):
# validate email # validate email
if email.strip() == "": if email.strip() == "":
return ("No email address provided.", 400) return ("No email address provided.", 400)
if not validate_email(email, mode='user'): elif not validate_email(email):
return ("Invalid email address.", 400) 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) validate_password(pw)