Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Fixed #6306 -- redirect_to_login() helper function now quotes the URL…

… arguments correctly. Thanks, SmileyChris

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 54f7da3 commit fbef599f60acb2b5511bf2cbbeb7861b4c7de974 @adrianholovaty adrianholovaty committed
Showing with 7 additions and 6 deletions.
  1. +7 −6 django/contrib/auth/
13 django/contrib/auth/
@@ -1,12 +1,13 @@
+from django import oldforms
+from django.contrib.auth import REDIRECT_FIELD_NAME
+from django.contrib.auth.decorators import login_required
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.forms import PasswordResetForm, PasswordChangeForm
-from django import oldforms
-from django.shortcuts import render_to_response
-from django.template import RequestContext
from django.contrib.sites.models import Site, RequestSite
from django.http import HttpResponseRedirect
-from django.contrib.auth.decorators import login_required
-from django.contrib.auth import REDIRECT_FIELD_NAME
+from django.shortcuts import render_to_response
+from django.template import RequestContext
+from django.utils.http import urlquote
from django.utils.translation import ugettext as _
def login(request, template_name='registration/login.html', redirect_field_name=REDIRECT_FIELD_NAME):
@@ -62,7 +63,7 @@ def redirect_to_login(next, login_url=None, redirect_field_name=REDIRECT_FIELD_N
if not login_url:
from django.conf import settings
login_url = settings.LOGIN_URL
- return HttpResponseRedirect('%s?%s=%s' % (login_url, redirect_field_name, next))
+ return HttpResponseRedirect('%s?%s=%s' % (login_url, urlquote(redirect_field_name), urlquote(next)))
def password_reset(request, is_admin_site=False, template_name='registration/password_reset_form.html',

0 comments on commit fbef599

Please sign in to comment.
Something went wrong with that request. Please try again.