#32553: Allow UserAttributeSimilarityValidator to validate against fields of
related models
----------------------------------------+------------------------
Reporter: Meiyer | Owner: nobody
Type: New feature | Status: new
Component: contrib.auth | Version: dev
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
----------------------------------------+------------------------
The password validator `UserAttributeSimilarityValidator` is currently too
rigid and allows comparison of the password only to the fields of the
`User` model, while ignoring the common case where there is also a profile
attached to the user (as a separate model). My suggestion is to relax the
attribute resolution so that also fields defined on related models could
be accessed; for example, by traversing a dotted path as in
`reduce(getattr, path.split('.'), obj)`.
Yet a better option could be to allow plugging into the validator by means
of an overridable method `get_user_attribute(self, attribute_name)` used
instead of a direct `getattr`, that will allow more customisation while
leaving the validation logic intact.
--
Ticket URL: <https://code.djangoproject.com/ticket/32553>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/052.4f4188beb74699cda2c592f22ca049e0%40djangoproject.com.