8b2ae993 by zhen

feat:登录使用AES加密

1 parent 88207ae8
...@@ -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 {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!