diff --git a/django/contrib/auth/views.py b/django/contrib/auth/views.py
index d3d8b4c..d194e0e 100644
|
a
|
b
|
from django.http import HttpResponseRedirect
|
| 8 | 8 | from django.contrib.auth.decorators import login_required |
| 9 | 9 | from django.contrib.auth import REDIRECT_FIELD_NAME |
| 10 | 10 | from django.utils.translation import ugettext as _ |
| | 11 | from django.conf import settings |
| 11 | 12 | |
| 12 | 13 | def login(request, template_name='registration/login.html', redirect_field_name=REDIRECT_FIELD_NAME): |
| 13 | 14 | "Displays the login form and handles the login action." |
| … |
… |
def login(request, template_name='registration/login.html', redirect_field_name=
|
| 18 | 19 | if not errors: |
| 19 | 20 | # Light security check -- make sure redirect_to isn't garbage. |
| 20 | 21 | if not redirect_to or '//' in redirect_to or ' ' in redirect_to: |
| 21 | | from django.conf import settings |
| 22 | 22 | redirect_to = settings.LOGIN_REDIRECT_URL |
| 23 | 23 | from django.contrib.auth import login |
| 24 | 24 | login(request, manipulator.get_user()) |
| … |
… |
def login(request, template_name='registration/login.html', redirect_field_name=
|
| 39 | 39 | 'site_name': current_site.name, |
| 40 | 40 | }, context_instance=RequestContext(request)) |
| 41 | 41 | |
| 42 | | def logout(request, next_page=None, template_name='registration/logged_out.html'): |
| | 42 | def logout(request, next_page=settings.LOGOUT_URL, template_name='registration/logged_out.html'): |
| 43 | 43 | "Logs out the user and displays 'You are logged out' message." |
| 44 | 44 | from django.contrib.auth import logout |
| 45 | 45 | logout(request) |
| … |
… |
def logout(request, next_page=None, template_name='registration/logged_out.html'
|
| 52 | 52 | def logout_then_login(request, login_url=None): |
| 53 | 53 | "Logs out the user if he is logged in. Then redirects to the log-in page." |
| 54 | 54 | if not login_url: |
| 55 | | from django.conf import settings |
| 56 | 55 | login_url = settings.LOGIN_URL |
| 57 | 56 | return logout(request, login_url) |
| 58 | 57 | |
| 59 | 58 | def redirect_to_login(next, login_url=None, redirect_field_name=REDIRECT_FIELD_NAME): |
| 60 | 59 | "Redirects the user to the login page, passing the given 'next' page" |
| 61 | 60 | if not login_url: |
| 62 | | from django.conf import settings |
| 63 | 61 | login_url = settings.LOGIN_URL |
| 64 | 62 | return HttpResponseRedirect('%s?%s=%s' % (login_url, redirect_field_name, next)) |
| 65 | 63 | |