From 9ab3a297bdfbe5f119e4f37a649bad8d34e58568 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Mon, 17 Aug 2020 11:46:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=93=8D=E4=BD=9C=E6=97=A5=E5=BF=97=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E6=8E=92=E9=99=A4=E6=95=8F=E6=84=9F=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/system/SysUserController.java | 1 - .../templates/system/user/profile/resetPwd.html | 6 +++--- .../com/ruoyi/framework/aspectj/LogAspect.java | 14 ++++++++++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java index f389b8435..f5109d291 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java @@ -175,7 +175,6 @@ public class SysUserController extends BaseController } @RequiresPermissions("system:user:resetPwd") - @Log(title = "重置密码", businessType = BusinessType.UPDATE) @GetMapping("/resetPwd/{userId}") public String resetPwd(@PathVariable("userId") Long userId, ModelMap mmap) { diff --git a/ruoyi-admin/src/main/resources/templates/system/user/profile/resetPwd.html b/ruoyi-admin/src/main/resources/templates/system/user/profile/resetPwd.html index b1fb5e05e..815f0af32 100644 --- a/ruoyi-admin/src/main/resources/templates/system/user/profile/resetPwd.html +++ b/ruoyi-admin/src/main/resources/templates/system/user/profile/resetPwd.html @@ -28,7 +28,7 @@
- + 请再次输入您的密码
@@ -57,7 +57,7 @@ minlength: 5, maxlength: 20 }, - confirm: { + confirmPassword: { required: true, equalTo: "#newPassword" } @@ -72,7 +72,7 @@ minlength: "密码不能小于6个字符", maxlength: "密码不能大于20个字符" }, - confirm: { + confirmPassword: { required: "请再次输入新密码", equalTo: "两次密码输入不一致" } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java index 74091eb49..3f4dc5b30 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java @@ -12,6 +12,8 @@ import org.aspectj.lang.reflect.MethodSignature; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.support.spring.PropertyPreFilters; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.enums.BusinessStatus; import com.ruoyi.common.json.JSON; @@ -34,6 +36,9 @@ public class LogAspect { private static final Logger log = LoggerFactory.getLogger(LogAspect.class); + /** 排除敏感属性字段 */ + public static final String[] EXCLUDE_PROPERTIES = { "password", "oldPassword", "newPassword", "confirmPassword" }; + // 配置织入点 @Pointcut("@annotation(com.ruoyi.common.annotation.Log)") public void logPointCut() @@ -154,8 +159,13 @@ public class LogAspect private void setRequestValue(SysOperLog operLog) throws Exception { Map map = ServletUtils.getRequest().getParameterMap(); - String params = JSON.marshal(map); - operLog.setOperParam(StringUtils.substring(params, 0, 2000)); + if (StringUtils.isNotEmpty(map)) + { + PropertyPreFilters.MySimplePropertyPreFilter excludefilter = new PropertyPreFilters().addFilter(); + excludefilter.addExcludes(EXCLUDE_PROPERTIES); + String params = JSONObject.toJSONString(map, excludefilter); + operLog.setOperParam(StringUtils.substring(params, 0, 2000)); + } } /**