register: use ModelForm, and print all errors

This commit is contained in:
2023-10-31 21:14:24 +01:00
parent 54cc1b1705
commit a0c0d813b6
20 changed files with 203 additions and 258 deletions

View File

@ -1,7 +1,10 @@
from django import forms
from ..settings import *
from django.contrib.auth.models import User
from django.contrib.auth import authenticate
from ..status_code import *
class ChangePasswordForm(forms.Form):
username = forms.CharField(label="username", max_length=USERNAME_MAX_SIZE, min_length=USERNAME_MIN_SIZE, required=True)
current_password = forms.CharField(label="current_password", max_length=PASSWORD_MAX_SIZE, min_length=PASSWORD_MIN_SIZE, required=True)
new_password = forms.CharField(label="new_password", max_length=PASSWORD_MAX_SIZE, min_length=PASSWORD_MIN_SIZE, required=True)
new_password = forms.CharField(required=True, error_messages = {
'required': PASSWORD_MISSING,
})