Opened 9 years ago

Closed 8 years ago

#11954 closed Bug (fixed)

?next linking to a login_required view doesn't work

Reported by: libwilliam Owned by: nobody
Component: contrib.auth Version: 1.1
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


On my site I link to a view that is login_required and the url has a next param in it.

When it arrives at the login page it looks like this.

It cannot handle that url so it redirects to /accounts/profile/

Change History (7)

comment:1 Changed 9 years ago by libwilliam

I also have another related problem.

I have a url that goes to a login_required view. When it arrives at the /accounts/login/ url it looks like this. It then doesn't redirect to the correct spot. I am guessing because of the %2B Is there a way around this?

comment:2 Changed 9 years ago by Thejaswi Puthraya

Component: UncategorizedAuthentication

comment:3 Changed 9 years ago by Russell Keith-Magee

milestone: 1.2
Triage Stage: UnreviewedAccepted

comment:4 Changed 9 years ago by Bruno Renié

This looks invalid to me, the login template needs to look like this:

<form method="post" action="{% url login %}">
  {{ form.as_p }}
  {% if next %} {# this is REDIRECT_FIELD_NAME #}
  <input type="hidden" name="next" value="{{ next }}" />{% endif %}
  <input type="submit" value="Sign in" />

If the hidden input isn't added, there is no way the view can redirect to the right URL.

This is fully documented here (scroll down)

comment:5 Changed 9 years ago by James Bennett

milestone: 1.2

1.2 is feature-frozen, moving this feature request off the milestone.

comment:6 Changed 8 years ago by Julien Phalip

Severity: Normal
Type: Bug

comment:7 Changed 8 years ago by Jannis Leidel

Easy pickings: unset
Resolution: fixed
Status: newclosed
UI/UX: unset

I believe this has been fixed a while ago.

Note: See TracTickets for help on using tickets.
Back to Top