Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
牛叉闪闪 2024-08-03 18:22:58 +08:00
commit 11e2663fb3
1 changed files with 3 additions and 3 deletions

View File

@ -156,11 +156,11 @@ public class UserController {
String currentUsername = SecurityUtils.getCurrentUsername();
UserDto user = userService.findByName(currentUsername);
String oldPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, passVo.getOldPass());
String newPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, passVo.getNewPass());
if (!passwordEncoder.matches(oldPass, user.getPassword())) {
throw new BadRequestException("修改失败,旧密码错误");
}
if (passwordEncoder.matches(newPass, user.getPassword())) {
System.out.println(oldPass);
if (passwordEncoder.matches(passVo.getNewPass(), user.getPassword())) {
throw new BadRequestException("新密码不能与旧密码相同");
}
String encPass = MD5Utils.encrypt( passVo.getNewPass());
@ -170,7 +170,7 @@ public class UserController {
}else {
shopStaffRepository.updatePass(currentUsername,encPass,System.currentTimeMillis());
}
userService.updatePass(user.getUsername(),passwordEncoder.encode(newPass));
userService.updatePass(user.getUsername(),passwordEncoder.encode(passVo.getNewPass()));
onlineUserService.logout(tokenProvider.getToken(request));
return new ResponseEntity<>(HttpStatus.OK);
}