mirror of https://github.com/jumpserver/jumpserver
perf: try to decrypt then origin value
parent
b9c60d856f
commit
28d5475d0f
|
@ -144,6 +144,10 @@ class EncryptMixin:
|
|||
return value
|
||||
|
||||
plain_value = Encryptor(value).decrypt()
|
||||
|
||||
# 如果解密失败,则使用原来的值
|
||||
if not plain_value:
|
||||
plain_value = value
|
||||
# 可能和Json mix,所以要先解密,再json
|
||||
sp = super()
|
||||
if hasattr(sp, "from_db_value"):
|
||||
|
@ -166,9 +170,6 @@ class EncryptMixin:
|
|||
class EncryptTextField(EncryptMixin, models.TextField):
|
||||
description = _("Encrypt field using Secret Key")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
|
||||
class EncryptCharField(EncryptMixin, models.CharField):
|
||||
@staticmethod
|
||||
|
|
Loading…
Reference in New Issue