|
@ -108,10 +108,11 @@ public class UserController { |
|
|
String oldPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey,passVo.getString("oldPass")); |
|
|
String oldPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey,passVo.getString("oldPass")); |
|
|
String newPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey,passVo.getString("newPass")); |
|
|
String newPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey,passVo.getString("newPass")); |
|
|
SysUser user = userService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUsername, SecurityUtils.getCurrentUsername())); |
|
|
SysUser user = userService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUsername, SecurityUtils.getCurrentUsername())); |
|
|
if (!SaSecureUtil.md5BySalt(user.getPassword(), "salt").equals(SaSecureUtil.md5BySalt(oldPass, "salt"))) { |
|
|
|
|
|
|
|
|
if (!user.getPassword().equals(SaSecureUtil.md5BySalt(oldPass, "salt"))) { |
|
|
throw new BadRequestException("修改失败,旧密码错误"); |
|
|
throw new BadRequestException("修改失败,旧密码错误"); |
|
|
} |
|
|
} |
|
|
if (!SaSecureUtil.md5BySalt(user.getPassword(), "salt").equals(SaSecureUtil.md5BySalt(newPass, "salt"))) { |
|
|
if (user.getPassword().equals(SaSecureUtil.md5BySalt(newPass, "salt"))) { |
|
|
throw new BadRequestException("新密码不能与旧密码相同"); |
|
|
throw new BadRequestException("新密码不能与旧密码相同"); |
|
|
} |
|
|
} |
|
|
user.setPassword(SaSecureUtil.md5BySalt(newPass, "salt")); |
|
|
user.setPassword(SaSecureUtil.md5BySalt(newPass, "salt")); |
|
|