summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2020-02-03 10:49:29 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-02-04 08:05:02 +0100
commitbcc9fa25285f506666fa5074fc43c7114d61bb79 (patch)
tree3927895afa7fbc8528957c904dfaabcc8d881342
parent6f9ecc23f676e7a6f25d1a6cf830fe638a1eb589 (diff)
Refs #27604 -- Added CookieStorage.key_salt to allow customization.
-rw-r--r--django/contrib/messages/storage/cookie.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/django/contrib/messages/storage/cookie.py b/django/contrib/messages/storage/cookie.py
index ad3a255fb7..eb7d6d6bc5 100644
--- a/django/contrib/messages/storage/cookie.py
+++ b/django/contrib/messages/storage/cookie.py
@@ -56,6 +56,7 @@ class CookieStorage(BaseStorage):
# restrict the session cookie to 1/2 of 4kb. See #18781.
max_cookie_size = 2048
not_finished = '__messagesnotfinished__'
+ key_salt = 'django.contrib.messages'
def _get(self, *args, **kwargs):
"""
@@ -122,8 +123,7 @@ class CookieStorage(BaseStorage):
Create an HMAC/SHA1 hash based on the value and the project setting's
SECRET_KEY, modified to make it unique for the present purpose.
"""
- key_salt = 'django.contrib.messages'
- return salted_hmac(key_salt, value).hexdigest()
+ return salted_hmac(self.key_salt, value).hexdigest()
def _encode(self, messages, encode_empty=False):
"""