From 3014942bf0f6b0d44d841a57129e5d1d2ad6376d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=87=AA=E5=B8=A6=E5=A4=A7=E4=BD=AC=E6=B0=94=E5=9C=BA?= <188633308@qq.com> Date: Thu, 13 May 2021 13:58:24 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E7=99=BB=E5=BD=95=E5=AF=86=E7=A0=81?= =?UTF-8?q?=E8=BF=9B=E8=A1=8Crsa=E9=9D=9E=E5=AF=B9=E7=A7=B0=E5=8A=A0?= =?UTF-8?q?=E5=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Web/src/common/login/index.js | 6 ++++-- Web/src/util/global/index.js | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Web/src/common/login/index.js b/Web/src/common/login/index.js index a1adb23..5c8af41 100644 --- a/Web/src/common/login/index.js +++ b/Web/src/common/login/index.js @@ -2,12 +2,14 @@ import { api } from '@/common/api' import { token } from '@/common/token' import { encryptByDES, decryptByDES } from '@/util/des' import { encryptByRSA } from '@/util/rsa' -import { removeGlobal } from '@/util/global' +import { removeGlobal, RSA_PUBLIC_KEY } from '@/util/global' import app from '@/main' const doLogin = (args) => { return new Promise((resolve, reject) => { - api.login(args).then(({ success, data, message }) => { + let { account, password } = args + password = encryptByRSA(password, RSA_PUBLIC_KEY) + api.login({ account, password }).then(({ success, data, message }) => { if (success) { token.value = data app.$message.success('登录成功') diff --git a/Web/src/util/global/index.js b/Web/src/util/global/index.js index 8c63c58..3eb220e 100644 --- a/Web/src/util/global/index.js +++ b/Web/src/util/global/index.js @@ -26,4 +26,6 @@ export const removeGlobal = () => { } export const getGlobal = () => { return JSON.parse(decryptByDES(window.sessionStorage.getItem(GLOBAL_INFO_KEY))) -} \ No newline at end of file +} + +export const RSA_PUBLIC_KEY = '-----BEGIN PUBLIC KEY-----MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC273zAyijb3uX6O66VThrdfHtzZJn3d/SBM8qiETS7PijyNY3zNecAB+F/owxOWSB/6ojBo5Eu0FCiENxfpenTZB7sKrYu6NVH5gkfHLa6jz4pNzlGP93Q6RON4KjMZolAfRevBQ7vD6sOfJfMDnYi8xk+dRXcqc6PWY8fQiGs5QIDAQAB-----END PUBLIC KEY-----' \ No newline at end of file