mirror of
https://github.com/django/django.git
synced 2025-10-27 23:56:08 +00:00
Fixed #36546 -- Deprecated django.utils.crypto.constant_time_compare() in favor of hmac.compare_digest().
Signed-off-by: SaJH <wogur981208@gmail.com>
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import hmac
|
||||
from datetime import datetime
|
||||
|
||||
from django.conf import settings
|
||||
from django.utils.crypto import constant_time_compare, salted_hmac
|
||||
from django.utils.crypto import salted_hmac
|
||||
from django.utils.http import base36_to_int, int_to_base36
|
||||
|
||||
|
||||
@@ -67,7 +68,7 @@ class PasswordResetTokenGenerator:
|
||||
|
||||
# Check that the timestamp/uid has not been tampered with
|
||||
for secret in [self.secret, *self.secret_fallbacks]:
|
||||
if constant_time_compare(
|
||||
if hmac.compare_digest(
|
||||
self._make_token_with_timestamp(user, ts, secret),
|
||||
token,
|
||||
):
|
||||
|
||||
Reference in New Issue
Block a user