From 01f2451349c95b644f2d521dc4832714b92a8592 Mon Sep 17 00:00:00 2001 From: Joshua Tauberer Date: Sun, 22 Mar 2015 12:33:06 +0000 Subject: [PATCH] provide a better error message when creating a user account with non-ASCII characters --- management/mailconfig.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/management/mailconfig.py b/management/mailconfig.py index b95ee87e..5ac7d10b 100755 --- a/management/mailconfig.py +++ b/management/mailconfig.py @@ -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)