File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change 3838
3939 **is\_ safe\_ username ** takes the following optional arguments:
4040
41- - ``whitelist ``: a list of words that should be considered as always
41+ - ``whitelist ``: a case insensitive list of words that should be considered as always
4242 safe. Default: ``[] ``
43- - ``blacklist ``: a list of words that should be considered as unsafe. Default: ``[] ``
43+ - ``blacklist ``: a case insensitive list of words that should be considered as unsafe. Default: ``[] ``
4444- ``max_length ``: specify the maximun character a username can have. Default: ``None ``
4545- ``regex ``: regular expression string that must pass before the banned
4646 words is checked.
Original file line number Diff line number Diff line change @@ -28,8 +28,8 @@ def is_safe_username(
2828 if not re .match (regex , username ):
2929 return False
3030 wordlist = get_reserved_wordlist ()
31- whitelist = set (whitelist )
32- blacklist = set (blacklist )
31+ whitelist = set ([ each_whitelisted_name . lower () for each_whitelisted_name in whitelist ] )
32+ blacklist = set ([ each_blacklisted_name . lower () for each_blacklisted_name in blacklist ] )
3333 wordlist = wordlist - whitelist
3434 wordlist = wordlist .union (blacklist )
3535 return False if username .lower () in wordlist else True
You can’t perform that action at this time.
0 commit comments