From fbef599f60acb2b5511bf2cbbeb7861b4c7de974 Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Thu, 26 Jun 2008 04:11:53 +0000 Subject: [PATCH] Fixed #6306 -- redirect_to_login() helper function now quotes the URL arguments correctly. Thanks, SmileyChris git-svn-id: http://code.djangoproject.com/svn/django/trunk@7749 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/auth/views.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/django/contrib/auth/views.py b/django/contrib/auth/views.py index 9f447155ae..524710327a 100644 --- a/django/contrib/auth/views.py +++ b/django/contrib/auth/views.py @@ -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', email_template_name='registration/password_reset_email.html'):