Code

Opened 6 years ago

Closed 6 years ago

Last modified 3 years ago

#8402 closed (fixed)

Password change form still assumes oldforms variables

Reported by: mtredinnick Owned by:
Component: Contrib apps Version: master
Severity: Keywords: aug22sprint
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

This is a django.contrib.auth bug, but the relevant template is "django/contrib/admin/templates/registrations/password_change_form.html": this template uses the oldforms-style html_error_list instead of .errors to display error messsages.

The reason this isn't a simple trivial change is because a test should actually be written to test that form and ensure the problem doesn't occur again. To do that:

  • put a new unittest class in django.contrib.auth.tests.views
  • modify django.contrib.auth.tests.__init__ to include the class
  • hook up a /login/ URL in django.contrib.auth.urls, since you can't change the password without logging in.
  • work out a password for the testuser in the fixture data and update the fixture data's password hash. Then document what this password is for other test users somehow (in the fixture directory maybe?). It might be possible to guess the current password; I haven't tried. But just creating the hash for a know password (e.g. "test" would be fine.
  • At least test that trying to change a password and failing displays the error messages.

Attachments (1)

8402.add_password_change_tests_and_update_default_template_to_newforms.diff (6.2 KB) - added by mtrichardson 6 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 6 years ago by mtredinnick

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 6 years ago by mtrichardson

  • Owner changed from nobody to mtrichardson

comment:3 Changed 6 years ago by mtrichardson

The previous diff adds tests in addition to fixing the problem.

comment:4 Changed 6 years ago by mtrichardson

  • Owner mtrichardson deleted

comment:5 Changed 6 years ago by mtrichardson

  • Keywords aug22sprint added

comment:6 Changed 6 years ago by mtredinnick

(In [8496]) Updated password change template (in admin templates) to use current form
variables (rather than oldforms stuff). Patch from Mike Richardson. Refs #8402.

comment:7 Changed 6 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

Tests were committed in [8497], which is the last piece of this.

comment:8 Changed 3 years ago by jacob

  • milestone 1.0 deleted

Milestone 1.0 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.