#30952: KeyError: '_password_reset_token' during password reset.
------------------------------+--------------------------------------
     Reporter:  defigor       |                    Owner:  nobody
         Type:  Bug           |                   Status:  new
    Component:  contrib.auth  |                  Version:  2.1
     Severity:  Normal        |               Resolution:
     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 Andrey Shakurov):

 * cc: Andrey Shakurov (added)
 * status:  closed => new
 * resolution:  needsinfo =>


Comment:

 The same issue can be reproduced in newer versions. I've tested it in
 3.0.4 with database-backed sessions and all of the standard
 django.contrib.auth.urls
 Steps to reproduce:
 1. Open the first tab, login to your app.
 2. Open the second tab on "password_reset" page. Enter the email of a user
 from the first tab. Submit form.
 3. Click the "password_reset_confirm" link from an email that should've
 been received. Fill the form with your new password and submit it.

 This will trigger this line
 
[https://github.com/django/django/blob/master/django/contrib/auth/views.py#L302]
 against session without INTERNAL_RESET_SESSION_TOKEN which will lead to
 KeyError

 Way to fix the issue: use .pop() instead of del

 {{{
 self.request.session.pop(auth_views.INTERNAL_RESET_SESSION_TOKEN, None)
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30952#comment:3>
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/065.6adab2b7089e2b8184f2579dbc49cf90%40djangoproject.com.

Reply via email to