Skip to content

Commit

Permalink
Merge pull request #3476 from hughrun/block-invites
Browse files Browse the repository at this point in the history
Prevent invite requests from blocked domains
  • Loading branch information
mouse-reeve authored Dec 1, 2024
2 parents 6184567 + 023e622 commit de8ba3c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bookwyrm/forms/landing.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ def clean(self):
if email and models.User.objects.filter(email=email).exists():
self.add_error("email", _("A user with this email already exists."))

email_domain = email.split("@")[-1]
if email and models.EmailBlocklist.objects.filter(domain=email_domain).exists():
self.add_error("email", _("This email address cannot be registered."))

class Meta:
model = models.InviteRequest
fields = ["email", "answer"]
Expand Down

0 comments on commit de8ba3c

Please sign in to comment.