Opened 3 months ago
Last modified 6 weeks ago
#35693 assigned Cleanup/optimization
Password validators aren't callable
Reported by: | iamkorniichuk | Owned by: | iamkorniichuk |
---|---|---|---|
Component: | contrib.auth | Version: | dev |
Severity: | Normal | Keywords: | validators password callable |
Cc: | iamkorniichuk | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | yes |
Needs tests: | yes | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
By default validating fields use this syntax validator(value)
but password validators don't implement .__call__()
. Therefore making them unusable outside of validate_password()
.
This is small change doesn't change any behavior but add support for intuitive approach to password validators.
Change History (3)
comment:1 by , 3 months ago
comment:2 by , 3 months ago
Keywords: | validators added; validator validator removed |
---|---|
Needs documentation: | set |
Needs tests: | set |
Owner: | set to |
Status: | new → assigned |
Triage Stage: | Unreviewed → Accepted |
Version: | 5.1 → dev |
Thank you iamkorniichuk for creating this ticket.
As I mentioned in your PR, I agree that the inconsistency between the django.core.validators providing __call__
but password validators not providing it feels off. Accepting on that basis, also I couldn't find a previous conversation or request about this issue.
Please note that the PR definitely needs tests and docs updates, besides a small release note for 5.2.
Good luck!
I think it will be enough to add such a method to
django.contrib.auth.password_validation
classes: