diff --git a/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/sys/api/SecurityConfigService.java b/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/sys/api/SecurityConfigService.java index 5b67e1661..d97c46454 100644 --- a/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/sys/api/SecurityConfigService.java +++ b/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/sys/api/SecurityConfigService.java @@ -36,4 +36,12 @@ public interface SecurityConfigService { */ void validatePasswordSecurityRule(boolean updatePasswordFlag, String password); + /** + * 记录用户密码修改的日志 + * + * @author fengshuonan + * @since 2023/10/5 17:16 + */ + void recordPasswordEditLog(Long userId, String md5, String salt); + } diff --git a/kernel-s-system/system-business-permission/src/main/java/cn/stylefeng/roses/kernel/sys/modular/security/service/impl/SecurityConfigServiceImpl.java b/kernel-s-system/system-business-permission/src/main/java/cn/stylefeng/roses/kernel/sys/modular/security/service/impl/SecurityConfigServiceImpl.java index 277c21ea7..dd7c6c5c3 100644 --- a/kernel-s-system/system-business-permission/src/main/java/cn/stylefeng/roses/kernel/sys/modular/security/service/impl/SecurityConfigServiceImpl.java +++ b/kernel-s-system/system-business-permission/src/main/java/cn/stylefeng/roses/kernel/sys/modular/security/service/impl/SecurityConfigServiceImpl.java @@ -6,9 +6,12 @@ import cn.stylefeng.roses.kernel.sys.api.SecurityConfigService; import cn.stylefeng.roses.kernel.sys.api.exception.SysException; import cn.stylefeng.roses.kernel.sys.api.exception.enums.SecurityStrategyExceptionEnum; import cn.stylefeng.roses.kernel.sys.api.pojo.security.SecurityConfig; +import cn.stylefeng.roses.kernel.sys.modular.security.entity.SysUserPasswordRecord; +import cn.stylefeng.roses.kernel.sys.modular.security.service.SysUserPasswordRecordService; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.Date; /** * 系统配置的业务 @@ -22,6 +25,9 @@ public class SecurityConfigServiceImpl implements SecurityConfigService { @Resource private ConfigServiceApi configServiceApi; + @Resource + private SysUserPasswordRecordService sysUserPasswordRecordService; + @Override public SecurityConfig getSecurityConfig() { @@ -132,5 +138,15 @@ public class SecurityConfigServiceImpl implements SecurityConfigService { } + @Override + public void recordPasswordEditLog(Long userId, String md5, String salt) { + SysUserPasswordRecord sysUserPasswordRecord = new SysUserPasswordRecord(); + sysUserPasswordRecord.setUserId(userId); + sysUserPasswordRecord.setHistoryPassword(md5); + sysUserPasswordRecord.setHistoryPasswordSalt(salt); + sysUserPasswordRecord.setUpdatePasswordTime(new Date()); + this.sysUserPasswordRecordService.save(sysUserPasswordRecord); + } + }