Merge pull request #5320 from bernt-matthias/topic/allow_empty_mail

allow registration with empty email
This commit is contained in:
John Chilton
2018-03-20 14:37:56 -04:00
committed by GitHub
2 changed files with 3 additions and 4 deletions
+2 -2
View File
@@ -24,12 +24,12 @@ FILL_CHAR = '-'
PASSWORD_MIN_LEN = 6
def validate_email(trans, email, user=None, check_dup=True):
def validate_email(trans, email, user=None, check_dup=True, allow_empty=False):
"""
Validates the email format, also checks whether the domain is blacklisted in the disposable domains configuration.
"""
message = ''
if user and user.email == email:
if (user and user.email == email) or (email == "" and allow_empty):
return message
if not(VALID_EMAIL_RE.match(email)):
message = "The format of the email address is not correct."
@@ -532,7 +532,7 @@ class User(BaseUIController, UsesFormDefinitionsMixin, CreatesUsersMixin, Create
if autoreg["auto_reg"]:
kwd['email'] = autoreg["email"]
kwd['username'] = autoreg["username"]
message = " ".join([validate_email(trans, kwd['email']),
message = " ".join([validate_email(trans, kwd['email'], allow_empty=True),
validate_publicname(trans, kwd['username'])]).rstrip()
if not message:
message, status, user, success = self.__register(trans, cntrller, False, no_redirect=skip_login_handling, **kwd)
@@ -572,7 +572,6 @@ class User(BaseUIController, UsesFormDefinitionsMixin, CreatesUsersMixin, Create
log.debug("trans.app.config.auth_config_file: %s" % trans.app.config.auth_config_file)
if not user:
message, status, user, success = self.__autoregistration(trans, login, password, status, kwd)
elif user.deleted:
message = "This account has been marked deleted, contact your local Galaxy administrator to restore the account."
if trans.app.config.error_email_to is not None: