Opened 7 years ago

Closed 5 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 7 years ago by libwilliam

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

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 7 years ago by thejaswi_puthraya

  • Component changed from Uncategorized to Authentication

comment:3 Changed 7 years ago by russellm

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

comment:4 Changed 7 years ago by brutasse

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 7 years ago by ubernostrum

  • milestone 1.2 deleted

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

comment:6 Changed 5 years ago by julien

  • Severity set to Normal
  • Type set to Bug

comment:7 Changed 5 years ago by jezdez

  • Easy pickings unset
  • Resolution set to fixed
  • Status changed from new to closed
  • UI/UX unset

I believe this has been fixed a while ago.

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