Ticket #11457: 11457-5.patch

File 11457-5.patch, 3.9 KB (added by Bruno Renié, 16 years ago)

cleanup

  • django/contrib/auth/views.py

     
    1515from django.contrib.auth.models import User
    1616from django.views.decorators.cache import never_cache
    1717
     18
     19
     20
     21
    1822@csrf_protect
    1923@never_cache
    2024def login(request, template_name='registration/login.html',
     
    2630        form = authentication_form(data=request.POST)
    2731        if form.is_valid():
    2832            # Light security check -- make sure redirect_to isn't garbage.
    29             if not redirect_to or '//' in redirect_to or ' ' in redirect_to:
     33            if not redirect_to or ' ' in redirect_to:
    3034                redirect_to = settings.LOGIN_REDIRECT_URL
     35
     36
     37
     38
     39
     40
     41
    3142            from django.contrib.auth import login
    3243            login(request, form.get_user())
    3344            if request.session.test_cookie_worked():
  • django/contrib/auth/tests/views.py

     
    11import os
    22import re
     3
    34
    45from django.conf import settings
    5 from django.contrib.auth import SESSION_KEY
     6from django.contrib.auth import SESSION_KEY
    67from django.contrib.auth.forms import AuthenticationForm
    78from django.contrib.sites.models import Site, RequestSite
    89from django.contrib.auth.models import User
     
    183184        self.assertEquals(response.context['site_name'], site.name)
    184185        self.assert_(isinstance(response.context['form'], AuthenticationForm),
    185186                     'Login form is not an AuthenticationForm')
     187
     188
     189
     190
     191
     192
     193
     194
     195
     196
     197
     198
     199
     200
     201
     202
     203
     204
     205
     206
     207
     208
     209
     210
     211
     212
     213
     214
     215
     216
     217
     218
     219
     220
     221
     222
     223
     224
     225
     226
    186227       
    187228class LogoutTest(AuthViewsTestCase):
    188229    urls = 'django.contrib.auth.tests.urls'
Back to Top