Commits

Alexander Solovyov committed 98c3681

naive fix for non-unique names registration through openid

Comments (0)

Files changed (1)

apps/accounts/managers.py

             username = openid[7:37]
         else:
             username = email.replace('@', '-')
+        try:
+            while True:
+                User.objects.get(username=username)
+                username = username[:-2] + str(random.random(10, 100))
+        except User.DoesNotExist:
+            pass
         new_user = User(username=username, email=email, first_name=name)
         new_user.set_password(password)
         new_user.is_active = True