Skip to content

Commit

Permalink
fix: Username uniqueness check not taking case into account
Browse files Browse the repository at this point in the history
  • Loading branch information
pennersr committed Oct 23, 2017
1 parent 92810c9 commit 74abfbe
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions allauth/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,11 @@ def generate_unique_username(txts, regex=None):
adapter = get_adapter()
basename = _generate_unique_username_base(txts, regex)
candidates = generate_username_candidates(basename)
existing_users = filter_users_by_username(*candidates).values_list(
existing_usernames = filter_users_by_username(*candidates).values_list(
USER_MODEL_USERNAME_FIELD, flat=True)
existing_usernames = set([n.lower() for n in existing_usernames])
for candidate in candidates:
if candidate not in existing_users:
if candidate.lower() not in existing_usernames:
try:
return adapter.clean_username(candidate, shallow=True)
except ValidationError:
Expand Down

0 comments on commit 74abfbe

Please sign in to comment.