mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-23 00:26:33 +00:00
Prevent users from registering with blocked emails
This commit is contained in:
parent
cc61d44cef
commit
5441b5b7f3
1 changed files with 6 additions and 0 deletions
|
@ -42,6 +42,12 @@ class Register(View):
|
|||
email = form.data["email"]
|
||||
password = form.data["password"]
|
||||
|
||||
# make sure the email isn't blocked as spam
|
||||
email_domain = email.split("@")[-1]
|
||||
if models.EmailBlocklist.objects.filter(domain=email_domain).exists():
|
||||
# treat this like a successful registration, but don't do anything
|
||||
return redirect("confirm-email")
|
||||
|
||||
# check localname and email uniqueness
|
||||
if models.User.objects.filter(localname=localname).first():
|
||||
form.errors["localname"] = ["User with this username already exists"]
|
||||
|
|
Loading…
Reference in a new issue