1
0
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:
Arthur Hanson
2022-10-05 08:50:47 -07:00
committed by GitHub
parent 689f11a573
commit cc00789d35
2 changed files with 10 additions and 1 deletions

9
netbox/users/utils.py Normal file
View 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