2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-19 02:47:06 +00:00

duplicate email prevention

This commit is contained in:
2025-01-24 01:49:37 +00:00
parent 27a14d0a0f
commit 61722fd6c0
2 changed files with 15 additions and 15 deletions

View File

@@ -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."
)
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."
)