summaryrefslogtreecommitdiffstats
path: root/core/views/user_registration.py
diff options
context:
space:
mode:
Diffstat (limited to 'core/views/user_registration.py')
-rw-r--r--core/views/user_registration.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/core/views/user_registration.py b/core/views/user_registration.py
index 218b593..c0b3235 100644
--- a/core/views/user_registration.py
+++ b/core/views/user_registration.py
@@ -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,