aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--accounts/views.py15
-rw-r--r--version.txt2
2 files changed, 16 insertions, 1 deletions
diff --git a/accounts/views.py b/accounts/views.py
index 47b66a2..dc53660 100644
--- a/accounts/views.py
+++ b/accounts/views.py
@@ -1,4 +1,5 @@
import datetime
+from django import forms
from django.shortcuts import render
from django.urls import reverse
from django.conf import settings
@@ -43,12 +44,26 @@ MIDATA_ENABLED = settings.OAUTH_ENABLED
# override to remove help text
class RegisterForm(UserCreationForm):
+ email = forms.EmailField(required=True)
+
+ class Meta:
+ model = User
+ fields = ("username", "email", "password1", "password2")
+
def __init__(self, *args, **kwargs):
super(UserCreationForm, self).__init__(*args, **kwargs)
for fieldname in ['username', 'password1', 'password2']:
self.fields[fieldname].help_text = None
+ def save(self, commit=True):
+ user = super().save()
+ user.set_password(self.cleaned_data["password1"])
+ user.email = self.cleaned_data["email"]
+ if commit:
+ user.save()
+ return user
+
class AuthForm(AuthenticationForm):
error_messages = {
'invalid_login': ("Password errata e/o utente inesistente"),
diff --git a/version.txt b/version.txt
index 9ffce4e..962f641 100644
--- a/version.txt
+++ b/version.txt
@@ -1,2 +1,2 @@
version=0.7
-rev=1
+rev=2