From 2b62e945b09ef56e5a28389ad049deec1c347cec Mon Sep 17 00:00:00 2001 From: Jacob Kaplan-Moss Date: Wed, 18 Jun 2008 16:13:14 +0000 Subject: [PATCH] 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 --- AUTHORS | 1 + django/contrib/auth/views.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/AUTHORS b/AUTHORS index bb77b68ad5..861c67d10b 100644 --- a/AUTHORS +++ b/AUTHORS @@ -228,6 +228,7 @@ answer newbie questions, and generally made Django that much better: Nicola Larosa Rune Rønde Laursen Eugene Lazutkin + lcordier@point45.com Jeong-Min Lee Jannis Leidel Christopher Lenz diff --git a/django/contrib/auth/views.py b/django/contrib/auth/views.py index d3d8b4ccb7..ec7f0c8f83 100644 --- a/django/contrib/auth/views.py +++ b/django/contrib/auth/views.py @@ -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): "Displays the login form and handles the login action." - manipulator = AuthenticationForm(request) + manipulator = AuthenticationForm() redirect_to = request.REQUEST.get(redirect_field_name, '') if request.POST: errors = manipulator.get_validation_errors(request.POST) @@ -22,7 +22,8 @@ def login(request, template_name='registration/login.html', redirect_field_name= redirect_to = settings.LOGIN_REDIRECT_URL from django.contrib.auth import login login(request, manipulator.get_user()) - request.session.delete_test_cookie() + if request.session.test_cookie_worked(): + request.session.delete_test_cookie() return HttpResponseRedirect(redirect_to) else: errors = {}