#26161: django.contrib.auth password reset email reveals the user id
------------------------------+--------------------------------------
Reporter: bluetech | Owner: nobody
Type: Bug | Status: closed
Component: contrib.auth | Version: 1.9
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+--------------------------------------
Changes (by sergei-maertens):
* status: new => closed
* needs_better_patch: => 0
* resolution: => invalid
* needs_tests: => 0
* needs_docs: => 0
Comment:
If I understand the code correctly, the ID is required to associate the
token/url with the specified user, since there's no other way to retrieve
the user from the token - hashing is a one-way process.
Maybe `USERNAME_FIELD` could be used instead of the PK, but for that
there's the possibility to specify a different `token_generator`, as per
`django.contrib.auth.views.password_reset`:
{{{
#!python
def password_reset(request,
template_name='registration/password_reset_form.html',
email_template_name='registration/password_reset_email.html',
subject_template_name='registration/password_reset_subject.txt',
password_reset_form=PasswordResetForm,
token_generator=default_token_generator,
post_reset_redirect=None,
from_email=None,
extra_context=None,
html_email_template_name=None,
extra_email_context=None):
...
}}}
The associated `password_reset_form` can be overridden as well.
--
Ticket URL: <https://code.djangoproject.com/ticket/26161#comment:1>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/066.2ce9e76f802d4cff01e8f9f0f37ec402%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.