django-passwords icon indicating copy to clipboard operation
django-passwords copied to clipboard

Unable to override AdminPasswordChangeForm to use PasswordFields

Open heldinz opened this issue 9 years ago • 1 comments
trafficstars

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?

heldinz avatar Apr 28 '16 17:04 heldinz

Unfortunately I don't see why there should be problem :( Did you try using a debugger and step through it?

maccesch avatar Apr 29 '16 08:04 maccesch