feat:登录使用AES加密
Showing
2 changed files
with
3 additions
and
3 deletions
... | @@ -5,7 +5,7 @@ const AES_KEY = '94a80df2633b4944' | ... | @@ -5,7 +5,7 @@ const AES_KEY = '94a80df2633b4944' |
5 | export function aesEncode(str) { | 5 | export function aesEncode(str) { |
6 | const key = CryptoJS.enc.Utf8.parse(AES_KEY) | 6 | const key = CryptoJS.enc.Utf8.parse(AES_KEY) |
7 | const word = CryptoJS.enc.Utf8.parse(str) | 7 | const word = CryptoJS.enc.Utf8.parse(str) |
8 | 8 | debugger | |
9 | const encrypted = CryptoJS.AES.encrypt(word, key, { | 9 | const encrypted = CryptoJS.AES.encrypt(word, key, { |
10 | mode: CryptoJS.mode.ECB, | 10 | mode: CryptoJS.mode.ECB, |
11 | padding: CryptoJS.pad.Pkcs7 | 11 | padding: CryptoJS.pad.Pkcs7 | ... | ... |
... | @@ -33,8 +33,8 @@ export default { | ... | @@ -33,8 +33,8 @@ export default { |
33 | async handleLogin({ username, password }) { | 33 | async handleLogin({ username, password }) { |
34 | try { | 34 | try { |
35 | this.btnLoading = true | 35 | this.btnLoading = true |
36 | // const passPhrase = aesEncode(password) | 36 | const passPhrase = aesEncode(password) |
37 | const { code } = await this.login({ username, password }) | 37 | const { code } = await this.login({ username, password: passPhrase }) |
38 | if (code === 0) { | 38 | if (code === 0) { |
39 | this.$router.push({ path: '/' }) | 39 | this.$router.push({ path: '/' }) |
40 | } else { | 40 | } else { | ... | ... |
-
Please register or sign in to post a comment