0.8.30 check password

This commit is contained in:
SDE
2023-12-03 17:43:01 +03:00
parent 0deb85b5a3
commit ae6a68d85b
2 changed files with 15 additions and 21 deletions

View File

@@ -30,21 +30,15 @@ class RegistrationForm(forms.Form):
agreement = forms.BooleanField(initial=False, required=True)
def clean(self):
pass
# cleaned_data = super().clean()
# for item in self.changed_data:
# if item in self.data:
#
#
# cc_myself = cleaned_data.get("cc_myself")
# subject = cleaned_data.get("subject")
#
# if cc_myself and subject:
# # Only do something if both fields are valid so far.
# if "help" not in subject:
# raise ValidationError(
# "Did not send for 'help' in the subject despite " "CC'ing yourself."
# )
cleaned_data = super().clean()
if cleaned_data['confirm_password'] != cleaned_data['password']:
self.add_error("password", _('Пароль и подтверждение пароля не совпадают'))
self.add_error("confirm_password", _('Пароль и подтверждение пароля не совпадают'))
users = User.objects.filter(email=cleaned_data['email'])
if users:
self.add_error('email', _("Пользователь с указанным email уже существует"))