mirror of
https://github.com/django/django.git
synced 2025-08-03 02:23:12 +00:00
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>
This commit is contained in:
parent
7857507c7f
commit
c7fc9f20b4
17 changed files with 633 additions and 12 deletions
|
@ -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
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue