Fixed #3393: login view no longer assumes that set_test_cookie has been called. This is mildly backwards-incompatible, but in the "now it works the way it should have all along" sense. Thanks to James and lcordier for the patches.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@7692 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jacob Kaplan-Moss 2008-06-18 16:13:14 +00:00
parent c5f7caba72
commit 2b62e945b0
2 changed files with 4 additions and 2 deletions

View File

@ -228,6 +228,7 @@ answer newbie questions, and generally made Django that much better:
Nicola Larosa <nico@teknico.net> Nicola Larosa <nico@teknico.net>
Rune Rønde Laursen <runerl@skjoldhoej.dk> Rune Rønde Laursen <runerl@skjoldhoej.dk>
Eugene Lazutkin <http://lazutkin.com/blog/> Eugene Lazutkin <http://lazutkin.com/blog/>
lcordier@point45.com
Jeong-Min Lee <falsetru@gmail.com> Jeong-Min Lee <falsetru@gmail.com>
Jannis Leidel <jl@websushi.org> Jannis Leidel <jl@websushi.org>
Christopher Lenz <http://www.cmlenz.net/> Christopher Lenz <http://www.cmlenz.net/>

View File

@ -11,7 +11,7 @@ from django.utils.translation import ugettext as _
def login(request, template_name='registration/login.html', redirect_field_name=REDIRECT_FIELD_NAME): def login(request, template_name='registration/login.html', redirect_field_name=REDIRECT_FIELD_NAME):
"Displays the login form and handles the login action." "Displays the login form and handles the login action."
manipulator = AuthenticationForm(request) manipulator = AuthenticationForm()
redirect_to = request.REQUEST.get(redirect_field_name, '') redirect_to = request.REQUEST.get(redirect_field_name, '')
if request.POST: if request.POST:
errors = manipulator.get_validation_errors(request.POST) errors = manipulator.get_validation_errors(request.POST)
@ -22,6 +22,7 @@ def login(request, template_name='registration/login.html', redirect_field_name=
redirect_to = settings.LOGIN_REDIRECT_URL redirect_to = settings.LOGIN_REDIRECT_URL
from django.contrib.auth import login from django.contrib.auth import login
login(request, manipulator.get_user()) login(request, manipulator.get_user())
if request.session.test_cookie_worked():
request.session.delete_test_cookie() request.session.delete_test_cookie()
return HttpResponseRedirect(redirect_to) return HttpResponseRedirect(redirect_to)
else: else: