1
0
mirror of https://github.com/django/django.git synced 2025-10-27 15:46:10 +00:00

Fixed #28017 -- Allowed customizing PasswordResetTokenGenerator's secret.

This commit is contained in:
jannh
2017-05-26 13:37:36 +02:00
committed by Tim Graham
parent 2cbb095bec
commit c930c241f8
2 changed files with 23 additions and 0 deletions

View File

@@ -11,6 +11,7 @@ class PasswordResetTokenGenerator:
reset mechanism.
"""
key_salt = "django.contrib.auth.tokens.PasswordResetTokenGenerator"
secret = settings.SECRET_KEY
def make_token(self, user):
"""
@@ -61,6 +62,7 @@ class PasswordResetTokenGenerator:
hash = salted_hmac(
self.key_salt,
self._make_hash_value(user, timestamp),
secret=self.secret,
).hexdigest()[::2]
return "%s-%s" % (ts_b36, hash)