Ticket #8061: login-view.diff
File login-view.diff, 1.1 KB (added by , 16 years ago) |
---|
-
django/contrib/auth/views.py
13 13 from django.contrib.auth.models import User 14 14 import re 15 15 16 def login(request, template_name='registration/login.html', redirect_field_name=REDIRECT_FIELD_NAME ):16 def login(request, template_name='registration/login.html', redirect_field_name=REDIRECT_FIELD_NAME, check_test_cookie=False): 17 17 "Displays the login form and handles the login action." 18 18 redirect_to = request.REQUEST.get(redirect_field_name, '') 19 19 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) 21 24 if form.is_valid(): 22 25 # Light security check -- make sure redirect_to isn't garbage. 23 26 if not redirect_to or '//' in redirect_to or ' ' in redirect_to: