mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-18 14:16:45 +00:00
Merge pull request #3476 from hughrun/block-invites
Prevent invite requests from blocked domains
This commit is contained in:
commit
de8ba3cf86
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