From 0fa4ef24657a711492a0fadcfdb4da58d35d2710 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Wed, 17 Jan 2018 13:23:28 +0100 Subject: [PATCH] allow registration without mail --- lib/galaxy/security/validate_user_input.py | 4 ++-- lib/galaxy/webapps/galaxy/controllers/user.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/galaxy/security/validate_user_input.py b/lib/galaxy/security/validate_user_input.py index 5375a4afbb7..7150c0831e8 100644 --- a/lib/galaxy/security/validate_user_input.py +++ b/lib/galaxy/security/validate_user_input.py @@ -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." diff --git a/lib/galaxy/webapps/galaxy/controllers/user.py b/lib/galaxy/webapps/galaxy/controllers/user.py index 5d2a0eae80d..0033493a5d5 100644 --- a/lib/galaxy/webapps/galaxy/controllers/user.py +++ b/lib/galaxy/webapps/galaxy/controllers/user.py @@ -503,7 +503,7 @@ class User(BaseUIController, UsesFormDefinitionsMixin, CreatesUsersMixin, Create if autoreg[0]: kwd['email'] = autoreg[1] kwd['username'] = autoreg[2] - 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, 'user', False, **kwd)