summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorOlivier Le Thanh Duong <olivier@lethanh.be>2015-11-12 00:48:16 +0100
committerTim Graham <timograham@gmail.com>2016-02-25 07:18:33 -0500
commit10781b4c6ff981f581157957d221e7621e0bf4ed (patch)
tree9223912fbf71db5e850bb9951e19a2edd26b40ab /docs
parent4c18a8a3788a4cd25b75ae342a7244c5f775b213 (diff)
Fixed #12233 -- Allowed redirecting authenticated users away from the login view.
contrib.auth.views.login() has a new parameter `redirect_authenticated_user` to automatically redirect authenticated users visiting the login page. Thanks to dmathieu and Alex Buchanan for the original code and to Carl Meyer for the help and review.
Diffstat (limited to 'docs')
-rw-r--r--docs/releases/1.10.txt4
-rw-r--r--docs/topics/auth/default.txt10
2 files changed, 13 insertions, 1 deletions
diff --git a/docs/releases/1.10.txt b/docs/releases/1.10.txt
index a5e68759da..7ea4a5e4d5 100644
--- a/docs/releases/1.10.txt
+++ b/docs/releases/1.10.txt
@@ -86,6 +86,10 @@ Minor features
:func:`~django.contrib.auth.views.logout` view, if the view doesn't get a
``next_page`` argument.
+* The new ``redirect_authenticated_user`` parameter for the
+ :func:`~django.contrib.auth.views.login` view allows redirecting
+ authenticated users visiting the login page.
+
:mod:`django.contrib.contenttypes`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/docs/topics/auth/default.txt b/docs/topics/auth/default.txt
index 0d571a743c..64fcce49af 100644
--- a/docs/topics/auth/default.txt
+++ b/docs/topics/auth/default.txt
@@ -965,7 +965,7 @@ All authentication views
This is a list with all the views ``django.contrib.auth`` provides. For
implementation details see :ref:`using-the-views`.
-.. function:: login(request, template_name=`registration/login.html`, redirect_field_name='next', authentication_form=AuthenticationForm, current_app=None, extra_context=None)
+.. function:: login(request, template_name=`registration/login.html`, redirect_field_name='next', authentication_form=AuthenticationForm, current_app=None, extra_context=None, redirect_authenticated_user=False)
**URL name:** ``login``
@@ -991,11 +991,19 @@ implementation details see :ref:`using-the-views`.
* ``extra_context``: A dictionary of context data that will be added to the
default context data passed to the template.
+ * ``redirect_authenticated_user``: A boolean that controls whether or not
+ authenticated users accessing the login page will be redirected as if
+ they had just successfully logged in. Defaults to ``False``.
+
.. deprecated:: 1.9
The ``current_app`` parameter is deprecated and will be removed in
Django 2.0. Callers should set ``request.current_app`` instead.
+ .. versionadded:: 1.10
+
+ The ``redirect_authenticated_user`` parameter was added.
+
Here's what ``django.contrib.auth.views.login`` does:
* If called via ``GET``, it displays a login form that POSTs to the