We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 689f11a commit cc00789Copy full SHA for cc00789
netbox/netbox/settings.py
@@ -498,7 +498,7 @@ def _setting(name, default=None):
498
499
# Force usage of PostgreSQL's JSONB field for extra data
500
SOCIAL_AUTH_JSONFIELD_ENABLED = True
501
-
+SOCIAL_AUTH_CLEAN_USERNAME_FUNCTION = 'netbox.users.utils.clean_username'
502
503
#
504
# Django Prometheus
netbox/users/utils.py
@@ -0,0 +1,9 @@
1
+from social_core.storage import NO_ASCII_REGEX, NO_SPECIAL_REGEX
2
+
3
4
+def clean_username(value):
5
+ """Clean username removing any unsupported character"""
6
+ value = NO_ASCII_REGEX.sub('', value)
7
+ value = NO_SPECIAL_REGEX.sub('', value)
8
+ value = value.replace(':', '')
9
+ return value
0 commit comments