From 68ee18438e99995d2d108cccb36e75f77ea96d76 Mon Sep 17 00:00:00 2001
From: luodangjia <luodangjia>
Date: 星期二, 21 一月 2025 17:36:08 +0800
Subject: [PATCH] 1

---
 ruoyi-modules/ruoyi-company/src/main/java/com/ruoyi/company/controller/front/UserController.java |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/ruoyi-modules/ruoyi-company/src/main/java/com/ruoyi/company/controller/front/UserController.java b/ruoyi-modules/ruoyi-company/src/main/java/com/ruoyi/company/controller/front/UserController.java
index bd86815..1cc644c 100644
--- a/ruoyi-modules/ruoyi-company/src/main/java/com/ruoyi/company/controller/front/UserController.java
+++ b/ruoyi-modules/ruoyi-company/src/main/java/com/ruoyi/company/controller/front/UserController.java
@@ -100,7 +100,7 @@
         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("验证码已失效");
@@ -127,8 +127,7 @@
     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())){

--
Gitblit v1.7.1