Ticket #8061: login-view.diff

File login-view.diff, 1.1 KB (added by Joost Cassee, 16 years ago)
  • django/contrib/auth/views.py

     
    1313from django.contrib.auth.models import User
    1414import re
    1515
    16 def login(request, template_name='registration/login.html', redirect_field_name=REDIRECT_FIELD_NAME):
     16def login(request, template_name='registration/login.html', redirect_field_name=REDIRECT_FIELD_NAME, check_test_cookie=False):
    1717    "Displays the login form and handles the login action."
    1818    redirect_to = request.REQUEST.get(redirect_field_name, '')
    1919    if request.method == "POST":
    20         form = AuthenticationForm(data=request.POST)
     20        if check_test_cookie:
     21            form = AuthenticationForm(request, data=request.POST)
     22        else:
     23            form = AuthenticationForm(data=request.POST)
    2124        if form.is_valid():
    2225            # Light security check -- make sure redirect_to isn't garbage.
    2326            if not redirect_to or '//' in redirect_to or ' ' in redirect_to:
Back to Top