From 48bc7dd6b57f60f5b24b80a9e04bdd90de25b368 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Fri, 19 Nov 2021 19:42:40 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E4=B8=AA=E4=BA=BA=E4=BF=A1=E6=81=AF):=20?= =?UTF-8?q?=E6=96=B0=E6=97=A7=E5=AF=86=E7=A0=81=E4=B8=8D=E8=83=BD=E7=9B=B8?= =?UTF-8?q?=E5=90=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1007829 --user=郭雨琦 [个人信息]-修改密码-新密码和旧密码相同仍提交成功,应提示密码相同 --- .../src/main/java/io/metersphere/service/UserService.java | 2 +- .../components/settings/personal/PasswordInfo.vue | 8 ++++++-- frontend/src/i18n/en-US.js | 1 + frontend/src/i18n/zh-CN.js | 1 + frontend/src/i18n/zh-TW.js | 1 + 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/io/metersphere/service/UserService.java b/backend/src/main/java/io/metersphere/service/UserService.java index 4960bbc171..5a16470da0 100644 --- a/backend/src/main/java/io/metersphere/service/UserService.java +++ b/backend/src/main/java/io/metersphere/service/UserService.java @@ -526,7 +526,7 @@ public class UserService { String newPassword = request.getNewpassword(); String newPasswordMd5 = CodingUtil.md5(newPassword); if(StringUtils.equals(oldPassword,newPasswordMd5)){ - MSException.throwException(Translator.get("新修改的密码不能与旧密码一样 ")); + return null; } UserExample userExample = new UserExample(); userExample.createCriteria().andIdEqualTo(SessionUtils.getUser().getId()).andPasswordEqualTo(oldPassword); diff --git a/frontend/src/business/components/settings/personal/PasswordInfo.vue b/frontend/src/business/components/settings/personal/PasswordInfo.vue index 74e7ac99c2..e2ed76f09f 100644 --- a/frontend/src/business/components/settings/personal/PasswordInfo.vue +++ b/frontend/src/business/components/settings/personal/PasswordInfo.vue @@ -67,8 +67,12 @@ export default { return; } this.result = this.$post(this.updatePasswordPath, this.ruleForm, response => { - this.$success(this.$t('commons.modify_success')); - logout(); + if(!response.data){ + this.$error(this.$t('commons.personal_password_info')); + }else { + this.$success(this.$t('commons.modify_success')); + logout(); + } }); } else { return false; diff --git a/frontend/src/i18n/en-US.js b/frontend/src/i18n/en-US.js index fc0bd10a59..286434883e 100644 --- a/frontend/src/i18n/en-US.js +++ b/frontend/src/i18n/en-US.js @@ -80,6 +80,7 @@ export default { show: 'Show', report: 'Report', user: 'User', + personal_password_info:'Same old and new password', system: 'System', personal_setting: 'Personal Setting', api_keys: 'API Keys', diff --git a/frontend/src/i18n/zh-CN.js b/frontend/src/i18n/zh-CN.js index 3b13fb8158..664db68ec4 100644 --- a/frontend/src/i18n/zh-CN.js +++ b/frontend/src/i18n/zh-CN.js @@ -86,6 +86,7 @@ export default { user: '用户', system: '系统', personal_setting: '个人设置', + personal_password_info:'新旧密码相同', test_resource_pool: '测试资源池', system_setting: '系统设置', api: '接口测试', diff --git a/frontend/src/i18n/zh-TW.js b/frontend/src/i18n/zh-TW.js index c20ad9c15a..62890a04ba 100644 --- a/frontend/src/i18n/zh-TW.js +++ b/frontend/src/i18n/zh-TW.js @@ -86,6 +86,7 @@ export default { user: '用戶', system: '系統', personal_setting: '個人設置', + personal_password_info:'新舊密碼相同', test_resource_pool: '測試資源池', system_setting: '系統設置', api: '接口測試',