From 611b970530e7731f93d7f95333d11f0b25952853 Mon Sep 17 00:00:00 2001 From: fengshuonan Date: Wed, 23 Mar 2022 09:56:04 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=907.2.2=E3=80=91=E6=9B=B4=E6=96=B0C?= =?UTF-8?q?=E7=AB=AF=E5=AF=86=E7=A0=81=E6=A0=A1=E9=AA=8C=E7=9A=84=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modular/service/impl/CustomerServiceImpl.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/kernel-s-customer/customer-business/src/main/java/cn/stylefeng/roses/kernel/customer/modular/service/impl/CustomerServiceImpl.java b/kernel-s-customer/customer-business/src/main/java/cn/stylefeng/roses/kernel/customer/modular/service/impl/CustomerServiceImpl.java index 1cb332c3a..bffe8852b 100644 --- a/kernel-s-customer/customer-business/src/main/java/cn/stylefeng/roses/kernel/customer/modular/service/impl/CustomerServiceImpl.java +++ b/kernel-s-customer/customer-business/src/main/java/cn/stylefeng/roses/kernel/customer/modular/service/impl/CustomerServiceImpl.java @@ -331,13 +331,22 @@ public class CustomerServiceImpl extends ServiceImpl i // 校验旧密码是否正确 Boolean passwordRightFlag = passwordStoredEncryptApi.checkPassword(customerInfoRequest.getOldPassword(), customer.getPassword()); - if (!passwordRightFlag) { + + // 上一代密码校验md5 + boolean lastPasswordRightFlag = oldPasswordValidateApi.validatePassword(customerInfoRequest.getOldPassword(), customer.getOldPassword(), customer.getOldPasswordSalt()); + + if (!passwordRightFlag && !lastPasswordRightFlag) { throw new CustomerException(CustomerExceptionEnum.PWD_ERROR); } // 更新密码 String encryptPwd = passwordStoredEncryptApi.encrypt(customerInfoRequest.getNewPassword()); customer.setPassword(encryptPwd); + + // 如果有上一代密码,则清空掉 + customer.setOldPassword(CustomerConstants.DEFAULT_EMPTY_PASSWORD); + customer.setOldPasswordSalt(CustomerConstants.DEFAULT_EMPTY_PASSWORD); + this.updateById(customer); // 清除缓存中的用户信息