Code

Opened 5 years ago

Closed 5 years ago

#11692 closed (wontfix)

CSRF middleware causing contrib.auth password change tests to fail

Reported by: jdriscoll Owned by: nobody
Component: Uncategorized Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

When using the CSRF middleware, these three tests from django.contrib.auth.tests.views are failing with a 403 status (Response: "Cross Site Request Forgery detected. Request aborted."):

  • test_password_change_fails_with_invalid_old_password
  • test_password_change_fails_with_mismatched_passwords
  • test_password_change_succeeds

These tests pass when the CSRF middleware is disabled.

Currently running r11430.

Attachments (0)

Change History (1)

comment:1 Changed 5 years ago by lukeplant

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

You have to run the tests with the middleware disabled. None of the tests use proper browser emulation (i.e. posting hidden fields that are in the forms), and so will fail to get through the CSRF checks which rely on a hidden field.

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.