update 登录密码进行rsa非对称加密

This commit is contained in:
2021-05-13 13:58:24 +08:00
parent 6a0729c2f0
commit 3014942bf0
2 changed files with 7 additions and 3 deletions

View File

@@ -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('登录成功')