Skip to content

Commit

Permalink
Removed 2 sql queries, prevented race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton-Shutik committed Apr 22, 2020
1 parent b52a61b commit f5d9d4b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions allauth/account/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,14 @@ def sync_user_email_addresses(user):
and EmailAddress.objects.filter(email__iexact=email).exists():
# Bail out
return
EmailAddress.objects.create(user=user,
email=email,
primary=False,
verified=False)
EmailAddress.objects.get_or_create(
user=user,
email=email,
defaults={
'primary': False,
'verified': False
}
)


def filter_users_by_username(*username):
Expand Down

0 comments on commit f5d9d4b

Please sign in to comment.