fix: registration form population with unicode through tpa (#30935)
Fixes the registration form username field prefilling with the third party auth data when unicode usernames are allowed.
This commit is contained in:
@@ -67,8 +67,13 @@ def clean_json(value, of_type):
|
||||
|
||||
|
||||
def clean_username(username=''):
|
||||
""" Simple helper method to ensure a username is compatible with our system requirements. """
|
||||
return ('_').join(re.findall(r'[a-zA-Z0-9\-]+', username))[:USERNAME_MAX_LENGTH]
|
||||
"""
|
||||
Simple helper method to ensure a username is compatible with our system requirements.
|
||||
"""
|
||||
if settings.FEATURES.get("ENABLE_UNICODE_USERNAME"):
|
||||
return ('_').join(re.findall(settings.USERNAME_REGEX_PARTIAL, username))[:USERNAME_MAX_LENGTH]
|
||||
else:
|
||||
return ('_').join(re.findall(r'[a-zA-Z0-9\-]+', username))[:USERNAME_MAX_LENGTH]
|
||||
|
||||
|
||||
class AuthNotConfigured(SocialAuthBaseException):
|
||||
|
||||
Reference in New Issue
Block a user