Ticket #3393: 3393_2.diff

File 3393_2.diff, 1.0 KB (added by lcordier, 8 years ago)
  • django/contrib/auth/views.py

     
    1111
    1212def login(request, template_name='registration/login.html', redirect_field_name=REDIRECT_FIELD_NAME):
    1313    "Displays the login form and handles the login action."
    14     manipulator = AuthenticationForm(request)
     14    manipulator = AuthenticationForm()
    1515    redirect_to = request.REQUEST.get(redirect_field_name, '')
    1616    if request.POST:
    1717        errors = manipulator.get_validation_errors(request.POST)
     
    2222                redirect_to = settings.LOGIN_REDIRECT_URL
    2323            from django.contrib.auth import login
    2424            login(request, manipulator.get_user())
    25             request.session.delete_test_cookie()
     25            if request.session.test_cookie_worked():
     26                request.session.delete_test_cookie()
    2627            return HttpResponseRedirect(redirect_to)
    2728    else:
    2829        errors = {}
Back to Top