修复修改密码后登录提示密码错误的bug

This commit is contained in:
TinyAnts 2022-09-15 18:11:17 +08:00
parent c8a940b6e1
commit 7c6bbbbbfd
1 changed files with 13 additions and 0 deletions

View File

@ -303,6 +303,9 @@ public class SystemAuthAdminServiceImpl implements ISystemAuthAdminService {
model.setUpdateTime(System.currentTimeMillis() / 1000); model.setUpdateTime(System.currentTimeMillis() / 1000);
if (systemAuthAdminParam.getPassword() != null && !systemAuthAdminParam.getPassword().equals("")) { if (systemAuthAdminParam.getPassword() != null && !systemAuthAdminParam.getPassword().equals("")) {
if (systemAuthAdminParam.getPassword().length() < 6 || systemAuthAdminParam.getPassword().length() > 20) {
throw new OperateException("密码必须在6~20位");
}
String salt = ToolsUtil.randomString(5); String salt = ToolsUtil.randomString(5);
String pwd = ToolsUtil.makeMd5( systemAuthAdminParam.getPassword().trim() + salt); String pwd = ToolsUtil.makeMd5( systemAuthAdminParam.getPassword().trim() + salt);
model.setPassword(pwd); model.setPassword(pwd);
@ -311,6 +314,12 @@ public class SystemAuthAdminServiceImpl implements ISystemAuthAdminService {
systemAuthAdminMapper.updateById(model); systemAuthAdminMapper.updateById(model);
this.cacheAdminUserByUid(systemAuthAdminParam.getId()); this.cacheAdminUserByUid(systemAuthAdminParam.getId());
Integer id = LikeAdminThreadLocal.getAdminId();
if (systemAuthAdminParam.getPassword() != null && systemAuthAdminParam.getId().equals(id)) {
String token = Objects.requireNonNull(RequestUtil.handler()).getHeader("token");
RedisUtil.del(AdminConfig.backstageTokenKey + token);
}
} }
/** /**
@ -343,6 +352,10 @@ public class SystemAuthAdminServiceImpl implements ISystemAuthAdminService {
throw new OperateException("当前密码不正确!"); throw new OperateException("当前密码不正确!");
} }
if (systemAuthAdminParam.getPassword().length() > 20 || systemAuthAdminParam.getPassword().length() < 6) {
throw new OperateException("密码必须在6~20位!");
}
String salt = ToolsUtil.randomString(5); String salt = ToolsUtil.randomString(5);
String pwd = ToolsUtil.makeMd5( systemAuthAdminParam.getPassword().trim() + salt); String pwd = ToolsUtil.makeMd5( systemAuthAdminParam.getPassword().trim() + salt);
model.setPassword(pwd); model.setPassword(pwd);