Skip to content

Commit

Permalink
Added a way to recover already existing users | refs #21860
Browse files Browse the repository at this point in the history
  • Loading branch information
sdiemer committed May 15, 2024
1 parent 6210995 commit 430618b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions social_django/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ def get_username(cls, user):

@classmethod
def create_user(cls, *args, **kwargs):
if kwargs.get('email'):
# Special case: recover unassociated users
# (association broken by migration or account created by another backend)
for user in cls.get_users_by_email(kwargs['email']):
return user
username_field = cls.username_field()
if "username" in kwargs:
if username_field not in kwargs:
Expand Down

0 comments on commit 430618b

Please sign in to comment.