Merge pull request #9877 from jumpserver/pr@v2.28@fix_operatelog_hide_sth

fix: 操作日志显示用户加密后的密文,及日期格式调整
pull/9902/head
老广 2023-03-08 14:05:20 +08:00 committed by GitHub
commit c01d1973d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -2,13 +2,14 @@ import csv
import codecs
from itertools import chain
from datetime import datetime
from django.http import HttpResponse
from django.db import models
from settings.serializers import SettingsSerializer
from common.utils.timezone import as_current_tz
from common.utils import validate_ip, get_ip_city, get_logger
from common.db import fields
from .const import DEFAULT_CITY
@ -78,6 +79,8 @@ def model_to_dict_for_operate_log(
f.verbose_name = 'id'
elif isinstance(value, list):
value = [str(v) for v in value]
elif isinstance(value, datetime):
value = as_current_tz(value).strftime('%Y-%m-%d %H:%M:%S')
if include_model_fields or getattr(f, 'primary_key', False):
data[str(f.verbose_name)] = value

View File

@ -1,7 +1,7 @@
from werkzeug.local import Local
thread_local = Local()
encrypted_field_set = set()
encrypted_field_set = {'password'}
def _find(attr):