diff --git a/src/pages/package.json b/src/pages/package.json index 4460c5058..2fe2fb4c8 100644 --- a/src/pages/package.json +++ b/src/pages/package.json @@ -57,6 +57,7 @@ "express-art-template": "1.0.1", "intl-tel-input": "16.0.0", "js-base64": "^3.7.2", + "jsencrypt": "^3.3.1", "jsonp": "0.2.1", "query-string": "6.5.0", "sortablejs": "1.10.1", diff --git a/src/pages/src/common/rsa.js b/src/pages/src/common/rsa.js new file mode 100644 index 000000000..610c688eb --- /dev/null +++ b/src/pages/src/common/rsa.js @@ -0,0 +1,30 @@ +/** +* by making 蓝鲸智云-用户管理(Bk-User) available. +* Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved. +* Licensed under the MIT License (the "License"); +* you may not use this file except in compliance with the License. You may obtain a copy of the License at +* http://opensource.org/licenses/MIT +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and limitations under the License. +*/ +/* 数据RSA加密 */ +import JSEncrypt from 'jsencrypt'; + +export default { + // JSEncrypt 加密 + rsaPublicData(data, publicKey) { + const jsencrypt = new JSEncrypt(); + jsencrypt.setPublicKey(publicKey); + const result = jsencrypt.encrypt(data); + return result; + }, + // JSEncrypt 解密 + rsaPrivateData(data, privateKey) { + const jsencrypt = new JSEncrypt(); + jsencrypt.setPrivateKey(privateKey); + const result = jsencrypt.encrypt(data); + return result; + }, +}; diff --git a/src/pages/src/main.js b/src/pages/src/main.js index 918b408f8..081f9bc4f 100644 --- a/src/pages/src/main.js +++ b/src/pages/src/main.js @@ -26,6 +26,7 @@ import bus from '@/common/bus'; import cursor from '@/directives/cursor'; import { Base64 } from 'js-base64'; import xss from 'xss'; +import Rsa from '@/common/rsa'; Vue.component(VueCropper); Vue.use(vClickOutside); @@ -35,6 +36,7 @@ Vue.directive('cursor', cursor); Vue.config.devtools = true; Vue.prototype.$bus = new Vue(); Vue.use(Base64); +Vue.prototype.Rsa = Rsa; Vue.prototype.$xss = (html) => { const attrs = ['class', 'title', 'target', 'style', 'src', 'onerror']; return xss(html || '', { diff --git a/src/pages/src/store/modules/password.js b/src/pages/src/store/modules/password.js index b9edf642c..5dc789bad 100644 --- a/src/pages/src/store/modules/password.js +++ b/src/pages/src/store/modules/password.js @@ -41,5 +41,9 @@ export default { sendCode(context, params, config = {}) { return http.post('api/v1/web/passwords/reset/verification_code/verify/', params); }, + // 获取rsa公钥 + getRsa(context, params, config = {}) { + return http.get(`api/v1/web/passwords/settings/by_token/?token=${params}`); + }, }, }; diff --git a/src/pages/src/views/organization/details/UserMaterial.vue b/src/pages/src/views/organization/details/UserMaterial.vue index f5ac860a0..082a3220f 100644 --- a/src/pages/src/views/organization/details/UserMaterial.vue +++ b/src/pages/src/views/organization/details/UserMaterial.vue @@ -143,6 +143,7 @@ diff --git a/src/pages/src/views/password/Set.vue b/src/pages/src/views/password/Set.vue index 34e6632b6..492d36917 100644 --- a/src/pages/src/views/password/Set.vue +++ b/src/pages/src/views/password/Set.vue @@ -31,25 +31,26 @@
- {{setPasswordText}}{{$t('_需要设置新密码')}} -
-+ :class="['text', isError && 'show-error-info']">{{setPasswordText}}{{$t('_需要设置新密码')}}
+{{$t('请输入新密码进行密码重设')}}
+{{errorText}}
+ @focus="handleFocus" /> + @focus="handleFocus" />