Ticket #3185: login_url2.diff

File login_url2.diff, 1.8 KB (added by Vasily Sulatskov <redvasily@…>, 17 years ago)
  • django/contrib/auth/views.py

     
    66from django.contrib.sites.models import Site
    77from django.http import HttpResponseRedirect
    88from django.contrib.auth.decorators import login_required
    9 from django.contrib.auth import LOGIN_URL, REDIRECT_FIELD_NAME
     9from django.contrib.auth import LOGIN_URL, REDIRECT_FIELD_NAME, ACCOUNT_URL
    1010
    1111def login(request, template_name='registration/login.html'):
    1212    "Displays the login form and handles the login action."
     
    1717        if not errors:
    1818            # Light security check -- make sure redirect_to isn't garbage.
    1919            if not redirect_to or '://' in redirect_to or ' ' in redirect_to:
    20                 redirect_to = '/accounts/profile/'
     20                redirect_to = ACCOUNT_URL
    2121            from django.contrib.auth import login
    2222            login(request, manipulator.get_user())
    2323            request.session.delete_test_cookie()
  • django/contrib/auth/__init__.py

     
    11from django.core.exceptions import ImproperlyConfigured
    22
     3from django.conf import settings
     4
    35SESSION_KEY = '_auth_user_id'
    46BACKEND_SESSION_KEY = '_auth_user_backend'
    5 LOGIN_URL = '/accounts/login/'
     7
     8try:
     9    LOGIN_URL = settings.LOGIN_URL
     10except AttributeError:
     11    LOGIN_URL = '/accounts/login/'
     12
     13try:
     14    ACCOUNT_URL = settings.ACCOUNT_URL
     15except AttributeError:
     16    ACCOUNT_URL = '/accounts/profile/'
     17
    618REDIRECT_FIELD_NAME = 'next'
    719
    820def load_backend(path):
Back to Top