Commit e1818860 authored by PCoder's avatar PCoder

Decode username back to string from bytes after encode

parent 4441ba37
......@@ -96,7 +96,9 @@ def assign_username(user):
# Try to come up with a username
first_name, last_name = get_first_and_last_name(user.name)
user.username = unicodedata.normalize('NFKD', first_name + last_name).encode('ascii', 'ignore')
user.username = unicodedata.normalize(
'NFKD', first_name + last_name
).encode('ascii', 'ignore').decode('ascii', 'ignore')
user.username = "".join([char for char in user.username if char.isalnum()]).lower()
if user.username.strip() == "":
try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment