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.py26
1 files changed, 22 insertions, 4 deletions
diff --git a/core/views/user_registration.py b/core/views/user_registration.py
index df00ed9..d4ce58e 100644
--- a/core/views/user_registration.py
+++ b/core/views/user_registration.py
@@ -1,6 +1,7 @@
from django import forms
from django.http import HttpResponseRedirect
from django.shortcuts import render
+from django.core.exceptions import ValidationError
"""
This is the new individual user login registration, instead of everyone signing
@@ -13,7 +14,10 @@ def register(request):
form = register_form(request.POST)
if form.is_valid():
# <process form cleaned data>
- return HttpResponseRedirect("/success/")
+ un = form.cleaned_data["username"]
+ pw= form.cleaned_data["password1"]
+
+ return HttpResponseRedirect("/accounts/login/")
else:
form = register_form(initial={"visible": "True"})
@@ -26,17 +30,31 @@ class register_form(forms.Form): # not a model-form, just a form-form
attrs={"size": 35, "placeholder": "e.g. anathema-device",
"style": "vertical-align: text-top;"}
))
+ email = forms.CharField(strip=True, required=True,
+ label="email",
+ widget=forms.TextInput(
+ attrs={"size": 35, "placeholder": "e.g. anathema@potatohut.exp",
+ "style": "vertical-align: text-top;"}
+ ))
password1 = forms.CharField(strip=True, required=True,
- label="Password",
+ label="Troggle password",
widget=forms.TextInput(
attrs={"size": 30, "placeholder": "your new login password",
"style": "vertical-align: text-top;"}
))
password2 = forms.CharField(strip=True, required=True,
- label="Re-type your password",
+ label="Re-type your troggle password",
widget=forms.TextInput(
attrs={"size": 30, "placeholder": "same as the password above",
"style": "vertical-align: text-top;"}
) )
- # ) \ No newline at end of file
+ def clean(self):
+ cleaned_data = super().clean()
+ pw1 = cleaned_data.get("password1")
+ pw2 = cleaned_data.get("password2")
+
+ if pw1 != pw2:
+ raise ValidationError(
+ "Retyped password does not match initial password: please fix this."
+ ) \ No newline at end of file