From 674c23999cb6982a9d447fedec4d72e135201fee Mon Sep 17 00:00:00 2001 From: HappyDingning Date: Mon, 15 May 2023 00:12:22 +0800 Subject: Fixed #34565 -- Added support for async checking of user passwords. --- docs/topics/auth/customizing.txt | 7 +++++++ docs/topics/auth/passwords.txt | 7 +++++++ 2 files changed, 14 insertions(+) (limited to 'docs/topics') diff --git a/docs/topics/auth/customizing.txt b/docs/topics/auth/customizing.txt index 6cc48cacb1..78bee37a0f 100644 --- a/docs/topics/auth/customizing.txt +++ b/docs/topics/auth/customizing.txt @@ -695,11 +695,18 @@ The following attributes and methods are available on any subclass of were used. .. method:: models.AbstractBaseUser.check_password(raw_password) + .. method:: models.AbstractBaseUser.acheck_password(raw_password) + + *Asynchronous version*: ``acheck_password()`` Returns ``True`` if the given raw string is the correct password for the user. (This takes care of the password hashing in making the comparison.) + .. versionchanged:: 5.0 + + ``acheck_password()`` method was added. + .. method:: models.AbstractBaseUser.set_unusable_password() Marks the user as having no password set. This isn't the same as diff --git a/docs/topics/auth/passwords.txt b/docs/topics/auth/passwords.txt index 695c8d2571..0876ac4f6e 100644 --- a/docs/topics/auth/passwords.txt +++ b/docs/topics/auth/passwords.txt @@ -478,6 +478,9 @@ to create and validate hashed passwords. You can use them independently from the ``User`` model. .. function:: check_password(password, encoded, setter=None, preferred="default") +.. function:: acheck_password(password, encoded, asetter=None, preferred="default") + + *Asynchronous version*: ``acheck_password()`` 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 @@ -490,6 +493,10 @@ from the ``User`` model. to use the default (first entry of ``PASSWORD_HASHERS`` setting). See :ref:`auth-included-hashers` for the algorithm name of each hasher. + .. versionchanged:: 5.0 + + ``acheck_password()`` method was added. + .. function:: make_password(password, salt=None, hasher='default') Creates a hashed password in the format used by this application. It takes -- cgit v1.3