From c7fc9f20b49b5889a9a8f47de45165ac443c1a21 Mon Sep 17 00:00:00 2001 From: Hisham Mahmood Date: Sun, 5 May 2024 11:21:28 +0500 Subject: Fixed #31405 -- Added LoginRequiredMiddleware. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Adam Johnson Co-authored-by: Mehmet İnce Co-authored-by: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> --- docs/topics/auth/default.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'docs/topics') 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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- cgit v1.3