mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
9669 sanitize social auth usernames (#10549)
This commit is contained in:
9
netbox/users/utils.py
Normal file
9
netbox/users/utils.py
Normal file
@ -0,0 +1,9 @@
|
||||
from social_core.storage import NO_ASCII_REGEX, NO_SPECIAL_REGEX
|
||||
|
||||
|
||||
def clean_username(value):
|
||||
"""Clean username removing any unsupported character"""
|
||||
value = NO_ASCII_REGEX.sub('', value)
|
||||
value = NO_SPECIAL_REGEX.sub('', value)
|
||||
value = value.replace(':', '')
|
||||
return value
|
Reference in New Issue
Block a user