summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2022-11-28 08:13:51 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-11-28 08:14:40 +0100
commit44f755035d323e9c8817ec57b9879ab683b9f0d4 (patch)
treed1e3e4966d37dae4d94f0a609f2bf3d587842448 /docs
parent8a623d1354342753280eccf37757208821104cfb (diff)
[4.1.x] Doc's check_password()'s setter and preferred arguments.
Follow up to 90e05aaeac612a4251640564aa65f103ac635e12. Backport of 662497cece5480b39d1d0c7f68c7b0ca395be923 from main
Diffstat (limited to 'docs')
-rw-r--r--docs/topics/auth/passwords.txt14
1 files changed, 9 insertions, 5 deletions
diff --git a/docs/topics/auth/passwords.txt b/docs/topics/auth/passwords.txt
index 37ce8514b0..504766f7d0 100644
--- a/docs/topics/auth/passwords.txt
+++ b/docs/topics/auth/passwords.txt
@@ -485,14 +485,18 @@ The :mod:`django.contrib.auth.hashers` module provides a set of functions
to create and validate hashed passwords. You can use them independently
from the ``User`` model.
-.. function:: check_password(password, encoded)
+.. function:: check_password(password, encoded, setter=None, preferred="default")
If you'd like to manually authenticate a user by comparing a plain-text
password to the hashed password in the database, use the convenience
- function :func:`check_password`. It takes two arguments: the plain-text
- password to check, and the full value of a user's ``password`` field in the
- database to check against, and returns ``True`` if they match, ``False``
- otherwise.
+ function :func:`check_password`. It takes two mandatory arguments: the
+ plain-text password to check, and the full value of a user's ``password``
+ field in the database to check against. It returns ``True`` if they match,
+ ``False`` otherwise. Optionally, you can pass a callable ``setter`` that
+ takes the password and will be called when you need to regenerate it. You
+ can also pass ``preferred`` to change a hashing algorithm if you don't want
+ to use the default (first entry of ``PASSWORD_HASHERS`` setting). See
+ :ref:`auth-included-hashers` for the algorithm name of each hasher.
.. function:: make_password(password, salt=None, hasher='default')