mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-21 23:56:34 +00:00
Prevent invite requests from blocked domains
Prevents form submission when requesting an email invite using an address from a blocked domain. Fixes #3366
This commit is contained in:
parent
13381b9b4d
commit
023e62294e
1 changed files with 4 additions and 0 deletions
|
@ -64,6 +64,10 @@ class InviteRequestForm(CustomForm):
|
||||||
if email and models.User.objects.filter(email=email).exists():
|
if email and models.User.objects.filter(email=email).exists():
|
||||||
self.add_error("email", _("A user with this email already 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:
|
class Meta:
|
||||||
model = models.InviteRequest
|
model = models.InviteRequest
|
||||||
fields = ["email", "answer"]
|
fields = ["email", "answer"]
|
||||||
|
|
Loading…
Reference in a new issue