Merge pull request #3476 from hughrun/block-invites

Prevent invite requests from blocked domains
This commit is contained in:
Mouse Reeve 2024-11-30 19:25:03 -08:00 committed by GitHub
commit de8ba3cf86
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -64,6 +64,10 @@ class InviteRequestForm(CustomForm):
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"]