Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #3393: login view no longer assumes that set_test_cookie has be…

…en 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
  • Loading branch information...
commit 2b62e945b09ef56e5a28389ad049deec1c347cec 1 parent c5f7cab
Jacob Kaplan-Moss jacobian authored
Showing with 4 additions and 2 deletions.
  1. +1 −0  AUTHORS
  2. +3 −2 django/contrib/auth/views.py
1  AUTHORS
View
@@ -228,6 +228,7 @@ answer newbie questions, and generally made Django that much better:
Nicola Larosa <nico@teknico.net>
Rune Rønde Laursen <runerl@skjoldhoej.dk>
Eugene Lazutkin <http://lazutkin.com/blog/>
+ lcordier@point45.com
Jeong-Min Lee <falsetru@gmail.com>
Jannis Leidel <jl@websushi.org>
Christopher Lenz <http://www.cmlenz.net/>
5 django/contrib/auth/views.py
View
@@ -11,7 +11,7 @@
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 = {}
Please sign in to comment.
Something went wrong with that request. Please try again.