mirror of
https://github.com/django-q2/django-q2.git
synced 2026-09-15 13:37:56 +08:00
Merge branch 'master' into type_hints
This commit is contained in:
@@ -13,7 +13,7 @@ from django.core.signing import (
|
||||
)
|
||||
from django.utils import baseconv
|
||||
from django.utils.crypto import constant_time_compare
|
||||
from django.utils.encoding import force_bytes, force_str, force_text
|
||||
from django.utils.encoding import force_bytes, force_str
|
||||
|
||||
dumps = dumps
|
||||
|
||||
@@ -51,14 +51,12 @@ def loads(
|
||||
|
||||
class Signer(Sgnr):
|
||||
def unsign(self, signed_value):
|
||||
# force_str is removed in Django 2.0
|
||||
signed_value = force_str(signed_value)
|
||||
if self.sep not in signed_value:
|
||||
raise BadSignature('No "%s" found in value' % self.sep)
|
||||
value, sig = signed_value.rsplit(self.sep, 1)
|
||||
if constant_time_compare(sig, self.signature(value)):
|
||||
# force_text is removed in Django 2.0
|
||||
return force_text(value)
|
||||
return force_str(value)
|
||||
raise BadSignature('Signature "%s" does not match' % sig)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user