【8.0.1】【system】更新接口,增加修改密码的盐值记录日志

pull/57/head
fengshuonan 2023-10-05 17:19:29 +08:00
parent 08c1d34256
commit fc11e8c32d
2 changed files with 24 additions and 0 deletions

View File

@ -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);
}

View File

@ -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);
}
}