mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2026-01-20 04:43:16 +00:00
allow new registration only once
This commit is contained in:
@@ -181,6 +181,9 @@ def write_users(registered_users, encryptedfile, git_string):
|
||||
return True
|
||||
|
||||
class newregister_form(forms.Form): # not a model-form, just a form-form
|
||||
"""This is the form for a new user who has not been on expo before and
|
||||
does notalready have a username
|
||||
"""
|
||||
fullname = forms.CharField(strip=True, required=True,
|
||||
label="Forename Surname",
|
||||
widget=forms.TextInput(
|
||||
@@ -196,14 +199,22 @@ class newregister_form(forms.Form): # not a model-form, just a form-form
|
||||
|
||||
def clean(self):
|
||||
cleaned_data = super().clean()
|
||||
un = cleaned_data.get("fullname")
|
||||
|
||||
fullname = cleaned_data.get("fullname")
|
||||
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."
|
||||
)
|
||||
userslug = troggle_slugify(fullname)
|
||||
people = Person.objects.filter(slug=userslug)
|
||||
if len(people) != 0:
|
||||
raise ValidationError(
|
||||
"Duplicate name. There is already a username correspondng to this Forename Surname. " +
|
||||
"If you have been on expo before, you need to use the other form at expo.survex.com/accounts/register/ ." +
|
||||
)
|
||||
|
||||
|
||||
class register_form(forms.Form): # not a model-form, just a form-form
|
||||
username = forms.CharField(strip=True, required=True,
|
||||
|
||||
Reference in New Issue
Block a user