update 登录密码进行rsa非对称加密
This commit is contained in:
@@ -2,12 +2,14 @@ import { api } from '@/common/api'
|
|||||||
import { token } from '@/common/token'
|
import { token } from '@/common/token'
|
||||||
import { encryptByDES, decryptByDES } from '@/util/des'
|
import { encryptByDES, decryptByDES } from '@/util/des'
|
||||||
import { encryptByRSA } from '@/util/rsa'
|
import { encryptByRSA } from '@/util/rsa'
|
||||||
import { removeGlobal } from '@/util/global'
|
import { removeGlobal, RSA_PUBLIC_KEY } from '@/util/global'
|
||||||
import app from '@/main'
|
import app from '@/main'
|
||||||
|
|
||||||
const doLogin = (args) => {
|
const doLogin = (args) => {
|
||||||
return new Promise((resolve, reject) => {
|
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) {
|
if (success) {
|
||||||
token.value = data
|
token.value = data
|
||||||
app.$message.success('登录成功')
|
app.$message.success('登录成功')
|
||||||
|
|||||||
@@ -26,4 +26,6 @@ export const removeGlobal = () => {
|
|||||||
}
|
}
|
||||||
export const getGlobal = () => {
|
export const getGlobal = () => {
|
||||||
return JSON.parse(decryptByDES(window.sessionStorage.getItem(GLOBAL_INFO_KEY)))
|
return JSON.parse(decryptByDES(window.sessionStorage.getItem(GLOBAL_INFO_KEY)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const RSA_PUBLIC_KEY = '-----BEGIN PUBLIC KEY-----MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC273zAyijb3uX6O66VThrdfHtzZJn3d/SBM8qiETS7PijyNY3zNecAB+F/owxOWSB/6ojBo5Eu0FCiENxfpenTZB7sKrYu6NVH5gkfHLa6jz4pNzlGP93Q6RON4KjMZolAfRevBQ7vD6sOfJfMDnYi8xk+dRXcqc6PWY8fQiGs5QIDAQAB-----END PUBLIC KEY-----'
|
||||||
Reference in New Issue
Block a user