diff options
author | Philip Sargent <philip.sargent@gmail.com> | 2025-01-24 01:49:37 +0000 |
---|---|---|
committer | Philip Sargent <philip.sargent@gmail.com> | 2025-01-24 01:49:37 +0000 |
commit | 61722fd6c065f491770568eb0aad57194ce13d61 (patch) | |
tree | df64f0d030b9ccf97fb3bd7ad75465207ee3e219 /core | |
parent | 27a14d0a0f2ee40f4bcd3d0a8661a0cd068ad939 (diff) | |
download | troggle-61722fd6c065f491770568eb0aad57194ce13d61.tar.gz troggle-61722fd6c065f491770568eb0aad57194ce13d61.tar.bz2 troggle-61722fd6c065f491770568eb0aad57194ce13d61.zip |
duplicate email prevention
Diffstat (limited to 'core')
-rw-r--r-- | core/views/user_registration.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/core/views/user_registration.py b/core/views/user_registration.py index b17170c..218b593 100644 --- a/core/views/user_registration.py +++ b/core/views/user_registration.py @@ -198,15 +198,12 @@ class newregister_form(forms.Form): # not a model-form, just a form-form cleaned_data = super().clean()
un = cleaned_data.get("fullname")
- # expoers = Person.objects.filter(slug=un)
- # if len(expoers) == 0:
- # raise ValidationError(
- # "Sorry, we are not registering new people yet. Try again next week. We are still getting the bugs out of this.."
- # )
- # if len(expoers) != 1:
- # raise ValidationError(
- # "Sorry, that troggle identifier has duplicates. Contact a nerd on the Nerd email list, or (better) the Matrix website chat."
- # )
+ email = cleaned_data.get("email")
+ users = User.objects.filter(email=email)
+ if len(users) != 0:
+ raise ValidationError(
+ "Duplicate email address. Another registered user is already using this email address. Email addresses must be unique as that is how we reset forgotten passwords."
+ )
class register_form(forms.Form): # not a model-form, just a form-form
username = forms.CharField(strip=True, required=True,
@@ -258,4 +255,9 @@ class register_form(forms.Form): # not a model-form, just a form-form raise ValidationError(
"Sorry, that troggle identifier has duplicates. Contact a nerd on the Nerd email list, or (better) the Matrix website chat."
)
-
\ No newline at end of file + email = cleaned_data.get("email")
+ users = User.objects.filter(email=email)
+ if len(users) != 0:
+ raise ValidationError(
+ "Duplicate email address. Another registered user is already using this email address. Email addresses must be unique as that is how we reset forgotten passwords."
+ )
\ No newline at end of file |