I've been able to successfully subclass Django's UserCreationForm and PasswordChangeForm to use PasswordField instead of the regular PasswordInput widget, but I'm having issues with AdminPasswordChangeForm and I'm not sure why.
I don't have a very complex configuration, I've just defined a PASSWORD_MIN_LENGTH and PASSWORD_COMPLEXITY.
Firstly, I wanted to only override password1, since password2 has to match that anyway (that's also how I've done it with the other two forms). But if I do that with AdminPasswordChangeForm, only the first input field appears on the form; the second is simply missing.
Secondly, if I define both password1 and password2 as PasswordFields (or password1 as a PasswordField and password2 as a regular PasswordInput, exactly as it is defined in AdminPasswordChangeForm), I only see the correct error message if the password is not complex enough. Otherwise, I get the "Please correct the errors below message" at the top of the form, but no error message on either of the inputs. This is the case whether I enter the same, complex password in both inputs, or if I enter mismatched, complex passwords.
Any ideas for what's going wrong here?
I've been able to successfully subclass Django's
UserCreationFormandPasswordChangeFormto usePasswordFieldinstead of the regularPasswordInputwidget, but I'm having issues withAdminPasswordChangeFormand I'm not sure why.I don't have a very complex configuration, I've just defined a
PASSWORD_MIN_LENGTHandPASSWORD_COMPLEXITY.Firstly, I wanted to only override
password1, sincepassword2has to match that anyway (that's also how I've done it with the other two forms). But if I do that withAdminPasswordChangeForm, only the first input field appears on the form; the second is simply missing.Secondly, if I define both
password1andpassword2asPasswordFields (orpassword1as aPasswordFieldandpassword2as a regularPasswordInput, exactly as it is defined inAdminPasswordChangeForm), I only see the correct error message if the password is not complex enough. Otherwise, I get the "Please correct the errors below message" at the top of the form, but no error message on either of the inputs. This is the case whether I enter the same, complex password in both inputs, or if I enter mismatched, complex passwords.Any ideas for what's going wrong here?