|
@@ -357,7 +357,11 @@ public class SysUserController {
|
|
// 生成8位初始密码
|
|
// 生成8位初始密码
|
|
String randomPwd = RandomPwd.getRandomPwd(8);
|
|
String randomPwd = RandomPwd.getRandomPwd(8);
|
|
log.info("重置随机密码:"+randomPwd);
|
|
log.info("重置随机密码:"+randomPwd);
|
|
- boolean bo = sysUserService.resetPassword(Integer.parseInt(id), SmUtil.sm3(randomPwd).toUpperCase());
|
|
|
|
|
|
+ // 加密密码
|
|
|
|
+ String sm3password = SmUtil.sm3(randomPwd).toUpperCase();
|
|
|
|
+ // 签名
|
|
|
|
+ String signstr = SmUtil.sm3(sm3password).toUpperCase();
|
|
|
|
+ boolean bo = sysUserService.resetPassword(Integer.parseInt(id), sm3password,signstr);
|
|
if (!bo) {
|
|
if (!bo) {
|
|
return ResponseVO.fail("密码生成失败!");
|
|
return ResponseVO.fail("密码生成失败!");
|
|
}
|
|
}
|
|
@@ -455,8 +459,8 @@ public class SysUserController {
|
|
|
|
|
|
if (StringUtils.isEmpty(oldPassword)) {
|
|
if (StringUtils.isEmpty(oldPassword)) {
|
|
return ResponseVO.fail("旧密码不能为空!");
|
|
return ResponseVO.fail("旧密码不能为空!");
|
|
- } else if (!sysUser.getPassword().equals(SmUtil.sm3(oldPassword).toUpperCase())) {
|
|
|
|
- return ResponseVO.fail("旧密码不正确!");
|
|
|
|
|
|
+ } else if (! (sysUser.getPassword().equals(SmUtil.sm3(oldPassword).toUpperCase()) && sysUser.getSignstr().equals(SmUtil.sm3(sysUser.getPassword()).toUpperCase()))) {
|
|
|
|
+ return ResponseVO.fail("旧密码不正确或验签失败!");
|
|
}
|
|
}
|
|
|
|
|
|
if (StringUtils.isEmpty(newPassword)) {
|
|
if (StringUtils.isEmpty(newPassword)) {
|
|
@@ -485,7 +489,10 @@ public class SysUserController {
|
|
return ResponseVO.fail(ruleInfo);
|
|
return ResponseVO.fail(ruleInfo);
|
|
}
|
|
}
|
|
|
|
|
|
- sysUser.setPassword(SmUtil.sm3(newPassword).toUpperCase());
|
|
|
|
|
|
+ // 新密码加密
|
|
|
|
+ String sm3newpwd = SmUtil.sm3(newPassword).toUpperCase();
|
|
|
|
+ sysUser.setPassword(sm3newpwd);
|
|
|
|
+ sysUser.setSignstr(SmUtil.sm3(sm3newpwd).toUpperCase());
|
|
sysUser.setLastUpdatePwdTime(new Date());
|
|
sysUser.setLastUpdatePwdTime(new Date());
|
|
boolean bo = sysUserService.updateById(sysUser);
|
|
boolean bo = sysUserService.updateById(sysUser);
|
|
if (!bo) {
|
|
if (!bo) {
|