diff --git a/api/chalicelib/utils/helper.py b/api/chalicelib/utils/helper.py index ba89a8529..2633cf690 100644 --- a/api/chalicelib/utils/helper.py +++ b/api/chalicelib/utils/helper.py @@ -176,6 +176,11 @@ def is_alphabet_space_dash(word): return r.match(word) is not None +def remove_non_alphabet_space_dash(word): + r = re.compile("[^a-zA-Z -]") + return r.sub('', word) + + def merge_lists_by_key(l1, l2, key): merged = {} for item in l1 + l2: diff --git a/ee/api/chalicelib/core/signup.py b/ee/api/chalicelib/core/signup.py index ab0c03eb3..8c44061de 100644 --- a/ee/api/chalicelib/core/signup.py +++ b/ee/api/chalicelib/core/signup.py @@ -140,7 +140,10 @@ async def create_oauth_tenant(fullname: str, email: str): errors.append("Email address previously deleted.") if fullname is None or len(fullname) < 1 or not helper.is_alphabet_space_dash(fullname): - errors.append("Invalid full name.") + edited_fullname = helper.remove_non_alphabet_space_dash(fullname) + if len(edited_fullname) < 1: + errors.append("Invalid full name.") + fullname = edited_fullname if len(errors) > 0: logger.warning(