Skip to content

Commit

Permalink
fix: don't enforce uniqueness of empty emails. Fixes #1984
Browse files Browse the repository at this point in the history
  • Loading branch information
jerivas committed Feb 23, 2022
1 parent aa91d40 commit 11e843d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mezzanine/core/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,8 @@ class SitePermissionInline(admin.TabularInline):
class SitePermissionUserAdminForm(UserAdmin.form):
def clean_email(form):
email = form.cleaned_data.get("email")
if User.objects.exclude(id=form.instance.id).filter(email=email).exists():
same_email = User.objects.exclude(id=form.instance.id).filter(email=email)
if email and same_email.exists():
raise ValidationError(_("This email is already registered"))
return email

Expand Down

0 comments on commit 11e843d

Please sign in to comment.