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