From 8c1ccdccc266a84bf97a24f8659466c98bc0e175 Mon Sep 17 00:00:00 2001 From: yuxc <653031404@qq.com> Date: 星期三, 06 十二月 2023 13:56:44 +0800 Subject: [PATCH] 1、修改用户修改密码问题,由于avue版本兼容原因,改了调用方式。 --- Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/service/impl/UserServiceImpl.java | 8 +++++--- Source/UBCS-WEB/src/views/system/userinfo.vue | 48 ++++++++++++++++++++++++------------------------ 2 files changed, 29 insertions(+), 27 deletions(-) diff --git a/Source/UBCS-WEB/src/views/system/userinfo.vue b/Source/UBCS-WEB/src/views/system/userinfo.vue index 6c985b5..1a87d09 100644 --- a/Source/UBCS-WEB/src/views/system/userinfo.vue +++ b/Source/UBCS-WEB/src/views/system/userinfo.vue @@ -29,13 +29,32 @@ }, methods: { handleSubmit(form, done) { - if (this.index === 0) { updateInfo(form).then(res => { if (res.data.success) { - this.$message({ - type: "success", - message: "淇敼淇℃伅鎴愬姛!" - }); + if( form.oldPassword != undefined || form.newPassword1 != undefined || form.newPassword != undefined){ + updatePassword(form.oldPassword, form.newPassword, form.newPassword1).then(res => { + if (res.data.success) { + this.$message({ + type: "success", + message: "淇敼鎴愬姛!" + }); + } else { + this.$message({ + type: "error", + message: res.data.msg + }); + } + done(); + }, error => { + window.console.log(error); + done(); + }) + }else{ + this.$message({ + type: "success", + message: "淇敼淇℃伅鎴愬姛!" + }); + }; } else { this.$message({ type: "error", @@ -47,25 +66,6 @@ window.console.log(error); done(); }) - } else { - updatePassword(md5(form.oldPassword), md5(form.newPassword), md5(form.newPassword1)).then(res => { - if (res.data.success) { - this.$message({ - type: "success", - message: "淇敼瀵嗙爜鎴愬姛!" - }); - } else { - this.$message({ - type: "error", - message: res.data.msg - }); - } - done(); - }, error => { - window.console.log(error); - done(); - }) - } }, handleWitch() { if (this.index === 0) { diff --git a/Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/service/impl/UserServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/service/impl/UserServiceImpl.java index ff717d9..b1de27c 100644 --- a/Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/service/impl/UserServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/service/impl/UserServiceImpl.java @@ -378,9 +378,6 @@ if (!newPassword.equals(newPassword1)) { throw new ServiceException("璇疯緭鍏ユ纭殑纭瀵嗙爜!"); } - if (!user.getPassword().equals(DigestUtil.hex(oldPassword))) { - throw new ServiceException("鍘熷瘑鐮佷笉姝g‘!"); - } //鑾峰彇鐢ㄦ埛閲囩敤鐨勫瘑鐮佺瓥鐣� Strategy strategy = sysClient.getByUserId(userId).getData(); // 鍑犱箮涓嶄細鍑虹幇杩欑鎯呭喌 @@ -391,6 +388,11 @@ if(newPassword1.length() < strategy.getMinPwdLen() || newPassword1.length() > strategy.getMaxPwdLen()){ throw new ServiceException("瀵嗙爜涓繀椤诲惈鏈夈��"+strategy.getCombinationNames()+"銆戜腑鐨勩��"+strategy.getRequiredType()+"銆戠瀵嗙爜缁勫悎鏂瑰紡锛屼笖瀵嗙爜闀垮害蹇呴』鍦ㄣ��"+strategy.getMinPwdLen()+"-"+strategy.getMaxPwdLen()+"銆戣寖鍥村唴"); } + + oldPassword = DigestUtil.hex(DigestUtils.md5DigestAsHex((oldPassword).getBytes())); + if (!user.getPassword().equals(oldPassword)) { + throw new ServiceException("鍘熷瘑鐮佷笉姝g‘!"); + } List<String> regexs = sysClient.getRegexByList(Arrays.asList(strategy.getCombinationIds().split(","))).getData(); //鍒ゆ柇鏄惁婊¤冻缁勫悎鏂瑰紡涓殑蹇呭~绉嶇被鏁� int reqType = 0; -- Gitblit v1.9.3