Code

Opened 5 years ago

Closed 5 years ago

Last modified 3 years ago

#10306 closed (fixed)

login.html example FORM tag is wrong in http://docs.djangoproject.com/en/dev/topics/auth/

Reported by: jkafader Owned by: kkubasik
Component: Documentation Version: 1.0
Severity: Keywords: kkmegapatch
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Hi I just thought I'd pass this along:

the ACTION parameter on the FORM tag for your sample login.html template is almost certainly wrong. It should not be '.' -- I'm not an expert on FORM ACTION but I think it should instead be , which at least worked for me.

This cost me, actually, about an hour of development time, thinking there was something drastically wrong with the way I was passing or handling the ?next= parameter in my login form. You see, an action of '.' cuts off the GET CGI string, making your form unable to redirect properly (django.contrib.auth.views.login gets the 'redirect_to' variable from the GET string, not from POST), but still, confusingly, logging in the user correctly.

This really took up a lot of time to figure out, I guess I should have gone with my original instinct of action="" with my login.html rather than slavishly copying the one in the docs. But I just thought I'd let you know about an unnecessary gotcha.

--james

Attachments (2)

auth.diff (500 bytes) - added by kylef 5 years ago.
Diff for docs/topics/auth.txt
auth.2.diff (500 bytes) - added by kylef 5 years ago.
Diff for docs/topics/auth.txt

Download all attachments as: .zip

Change History (12)

comment:1 Changed 5 years ago by jkafader

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

sorry the above should read "It should not be '.' -- I'm not an expert on FORM ACTION, but I think it should instead be "" (empty string), which at least worked for me." I think the "" (empty string) double single quotes got stuck in the wiki formatting filter.

---james

comment:2 Changed 5 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

comment:3 Changed 5 years ago by jacob

  • milestone set to 1.1
  • Triage Stage changed from Unreviewed to Accepted

comment:4 Changed 5 years ago by kylef

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

Simply use:

    <form method="post" action="{% url django.contrib.auth.views.login %}">

Changed 5 years ago by kylef

Diff for docs/topics/auth.txt

Changed 5 years ago by kylef

Diff for docs/topics/auth.txt

comment:5 Changed 5 years ago by kylef

  • Triage Stage changed from Accepted to Ready for checkin

comment:6 Changed 5 years ago by jacob

  • Resolution fixed deleted
  • Status changed from closed to reopened

Please don't mark tickets as fixed until the change actually gets checked into Django.

comment:7 Changed 5 years ago by jacob

  • Triage Stage changed from Ready for checkin to Accepted

comment:8 Changed 5 years ago by kkubasik

  • Keywords kkmegapatch added
  • Owner changed from nobody to kkubasik
  • Status changed from reopened to new

comment:9 Changed 5 years ago by ubernostrum

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

(In [10269]) Fixed #10306: Corrected form action in auth login example.

comment:10 Changed 3 years ago by jacob

  • milestone 1.1 deleted

Milestone 1.1 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.