summaryrefslogtreecommitdiff
path: root/docs/topics/auth
diff options
context:
space:
mode:
authorHisham Mahmood <hishammahmood41@gmail.com>2024-05-05 11:21:28 +0500
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-05-22 08:51:17 +0200
commitc7fc9f20b49b5889a9a8f47de45165ac443c1a21 (patch)
tree113e55d5b047f479375638c1f17d9c127aedf618 /docs/topics/auth
parent7857507c7fc43350701700d4215a37baea7655f0 (diff)
Fixed #31405 -- Added LoginRequiredMiddleware.
Co-authored-by: Adam Johnson <me@adamj.eu> Co-authored-by: Mehmet İnce <mehmet@mehmetince.net> Co-authored-by: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
Diffstat (limited to 'docs/topics/auth')
-rw-r--r--docs/topics/auth/default.txt17
1 files changed, 17 insertions, 0 deletions
diff --git a/docs/topics/auth/default.txt b/docs/topics/auth/default.txt
index 795a1bdacc..1d2ea8132d 100644
--- a/docs/topics/auth/default.txt
+++ b/docs/topics/auth/default.txt
@@ -656,8 +656,25 @@ inheritance list.
``is_active`` flag on a user, but the default
:setting:`AUTHENTICATION_BACKENDS` reject inactive users.
+.. _disable-login-required-middleware-for-views:
+
.. currentmodule:: django.contrib.auth.decorators
+The ``login_not_required`` decorator
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. versionadded:: 5.1
+
+When :class:`~django.contrib.auth.middleware.LoginRequiredMiddleware` is
+installed, all views require authentication by default. Some views, such as the
+login view, may need to disable this behavior.
+
+.. function:: login_not_required()
+
+ Allows unauthenticated requests without redirecting to the login page when
+ :class:`~django.contrib.auth.middleware.LoginRequiredMiddleware` is
+ installed.
+
Limiting access to logged-in users that pass a test
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~