Remove any non alphanum character present in email for username
This commit is contained in:
parent
ea79fafb08
commit
a995f418b2
1 changed files with 3 additions and 0 deletions
|
@ -105,6 +105,9 @@ def assign_username(user):
|
|||
logger.debug("Inferred username from name is empty. So, "
|
||||
"inferring from email now.")
|
||||
user.username = user.email[0:user.email.index("@")]
|
||||
user.username = "".join(
|
||||
[char for char in user.username if char.isalnum()]
|
||||
).lower()
|
||||
except Exception as ex:
|
||||
logger.debug("Exception %s" % str(ex))
|
||||
user.username = get_random_string(
|
||||
|
|
Loading…
Reference in a new issue