|
@@ -48,9 +48,12 @@
|
|
|
import StarBackground from '@/components/star'
|
|
|
import {
|
|
|
getCodeImg,
|
|
|
- fontConfig
|
|
|
- } from '@/api/login'
|
|
|
- import Cookies from 'js-cookie'
|
|
|
+ fontConfig,getSecretKey
|
|
|
+ } from '@/api/login'
|
|
|
+ import {
|
|
|
+ encryptedData
|
|
|
+ }
|
|
|
+ import Cookies from 'js-cookie'
|
|
|
import {
|
|
|
encrypt,
|
|
|
decrypt
|
|
@@ -165,18 +168,22 @@
|
|
|
Cookies.remove('password')
|
|
|
Cookies.remove('rememberMe')
|
|
|
}
|
|
|
- this.$store.dispatch('Login', this.loginForm).then(() => {
|
|
|
- console.log('!@!@!@', this.redirect)
|
|
|
- this.$router.push({
|
|
|
- //path: this.redirect || '/'
|
|
|
- path: '/'
|
|
|
- }).catch(() => {})
|
|
|
- }).catch(() => {
|
|
|
- this.loading = false
|
|
|
- if (this.captchaOnOff) {
|
|
|
- this.getCode()
|
|
|
- }
|
|
|
- })
|
|
|
+ //登录前先获取密码加密传输的公钥,对密码进行加密
|
|
|
+ getSecretKey().then(res => {
|
|
|
+ const encryptedPassword = encryptedData(res.data,this.loginForm.password);
|
|
|
+ this.loginForm.password = encryptedPassword;
|
|
|
+ this.$store.dispatch('Login', this.loginForm).then(() => {
|
|
|
+ this.$router.push({
|
|
|
+ //path: this.redirect || '/'
|
|
|
+ path: '/'
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ this.loading = false
|
|
|
+ if (this.captchaOnOff) {
|
|
|
+ this.getCode()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
}
|