fix bug I introduced with automatic EmailAddress creation for LDAP users (#10347) (#10349)

(cherry picked from commit fd57b5354b)

Co-authored-by: Jacob Felknor <jacobfelknor073@gmail.com>
This commit is contained in:
github-actions[bot] 2025-09-19 08:14:03 +10:00 committed by GitHub
parent 9705ea90c2
commit bb576b16d8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

View File

@ -61,7 +61,10 @@ if settings.LDAP_AUTH:
user.save()
# if they got an email address from LDAP, create it now and make it the primary
if user.email:
if (
user.email
and not EmailAddress.objects.filter(user=user, email=user.email).exists()
):
EmailAddress.objects.create(user=user, email=user.email, primary=True)