Skip to content

Commit

Permalink
Fix the final_username may be empty and will skip the loop.
Browse files Browse the repository at this point in the history
  • Loading branch information
littlezz committed Apr 16, 2015
1 parent f4247db commit c50aed1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion social/pipeline/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ def get_username(strategy, details, user=None, *args, **kwargs):
# Generate a unique username for current user using username
# as base but adding a unique hash at the end. Original
# username is cut to avoid any field max_length.
while storage.user.user_exists(username=final_username):
# The final_username may be empty and will skip the loop.
while storage.user.user_exists(username=final_username) or not final_username:
username = short_username + uuid4().hex[:uuid_length]
final_username = slug_func(clean_func(username[:max_length]))
else:
Expand Down

0 comments on commit c50aed1

Please sign in to comment.