Commit 88bb256e by Michael Hall

skip ahead to a number that is likely available when generating a sequence…

skip ahead to a number that is likely available when generating a sequence number to append to a duplicate username
parent 1b277c07
...@@ -198,8 +198,10 @@ class OpenIDBackend: ...@@ -198,8 +198,10 @@ class OpenIDBackend:
"already in use for a different account." % nickname) "already in use for a different account." % nickname)
# Pick a username for the user based on their nickname, # Pick a username for the user based on their nickname,
# checking for conflicts. # checking for conflicts. Start with number of existing users who's
i = 1 # username starts with this nickname to avoid having to iterate over
# all of the existing ones.
i = User.objects.filter(username__startswith=nickname).count() + 1
while True: while True:
username = nickname username = nickname
if i > 1: if i > 1:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment