| | |
| | | if (!user.getPhone().equals(updatePhone.getOldPhone())) { |
| | | return R.fail("旧手机号错误"); |
| | | } |
| | | String verifyKey = CacheConstants.PHONE_CODE_KEY + StringUtils.nvl(user.getPhone(), ""); |
| | | String verifyKey = CacheConstants.PHONE_CODE_KEY + StringUtils.nvl(updatePhone.getNewPhone(), ""); |
| | | String captcha = redisService.getCacheObject(verifyKey); |
| | | if (captcha == null) { |
| | | throw new CaptchaException("验证码已失效"); |
| | |
| | | public R<Void> updatePassword(@RequestBody UpdatePassword updatePassword) { |
| | | AppUser appLoginUser = SecurityUtils.getAppLoginUser(); |
| | | User user = userService.getById(appLoginUser.getUserId()); |
| | | String oldPassword = SecurityUtils.encryptPassword(updatePassword.getOldPassword()); |
| | | if (!user.getPassword().equals(oldPassword)) { |
| | | if (!SecurityUtils.matchesPassword(updatePassword.getOldPassword(), user.getPassword())) { |
| | | return R.fail("旧密码错误"); |
| | | } |
| | | if (!updatePassword.getNewPassword().equals(updatePassword.getConfirmPassword())){ |