diff options
| author | Jacob Kaplan-Moss <jacob@jacobian.org> | 2008-06-18 16:13:14 +0000 |
|---|---|---|
| committer | Jacob Kaplan-Moss <jacob@jacobian.org> | 2008-06-18 16:13:14 +0000 |
| commit | 2b62e945b09ef56e5a28389ad049deec1c347cec (patch) | |
| tree | 6380f1f947fc74c72085e34d56faf611438c2005 | |
| parent | c5f7caba72063e0f9496b3a8de00c27fe061516a (diff) | |
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
| -rw-r--r-- | AUTHORS | 1 | ||||
| -rw-r--r-- | django/contrib/auth/views.py | 5 |
2 files changed, 4 insertions, 2 deletions
@@ -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/> 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 = {} |
