1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Completed test coverage for contrib.auth.forms.

This commit is contained in:
Marcelo Galigniana
2022-10-23 08:42:40 -03:00
committed by Mariusz Felisiak
parent 022a864a5d
commit b440493eaa
2 changed files with 36 additions and 6 deletions

View File

@@ -378,12 +378,11 @@ class SetPasswordForm(forms.Form):
def clean_new_password2(self):
password1 = self.cleaned_data.get("new_password1")
password2 = self.cleaned_data.get("new_password2")
if password1 and password2:
if password1 != password2:
raise ValidationError(
self.error_messages["password_mismatch"],
code="password_mismatch",
)
if password1 and password2 and password1 != password2:
raise ValidationError(
self.error_messages["password_mismatch"],
code="password_mismatch",
)
password_validation.validate_password(password2, self.user)
return password2