mirror of
https://github.com/django/django.git
synced 2025-08-21 01:09:13 +00:00
Fixed #36439 -- Optimized acheck_password by using sync_to_async on verify_password.
This commit is contained in:
parent
6ea3319079
commit
748ca0a146
@ -6,6 +6,8 @@ import importlib
|
||||
import math
|
||||
import warnings
|
||||
|
||||
from asgiref.sync import sync_to_async
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.core.signals import setting_changed
|
||||
@ -86,7 +88,10 @@ def check_password(password, encoded, setter=None, preferred="default"):
|
||||
|
||||
async def acheck_password(password, encoded, setter=None, preferred="default"):
|
||||
"""See check_password()."""
|
||||
is_correct, must_update = verify_password(password, encoded, preferred=preferred)
|
||||
is_correct, must_update = await sync_to_async(
|
||||
verify_password,
|
||||
thread_sensitive=False,
|
||||
)(password, encoded, preferred=preferred)
|
||||
if setter and is_correct and must_update:
|
||||
await setter(password)
|
||||
return is_correct
|
||||
|
Loading…
x
Reference in New Issue
Block a user