|
@@ -64,7 +64,7 @@
|
|
|
<script>
|
|
|
import { getCodeImg } from "@/api/login";
|
|
|
import Cookies from "js-cookie";
|
|
|
-import { encrypt, decrypt } from '@/utils/jsencrypt'
|
|
|
+import { encrypt, decrypt, encryptString } from '@/utils/jsencrypt'
|
|
|
|
|
|
export default {
|
|
|
name: "Login",
|
|
@@ -92,7 +92,8 @@ export default {
|
|
|
captchaEnabled: true,
|
|
|
// 注册开关
|
|
|
register: false,
|
|
|
- redirect: undefined
|
|
|
+ redirect: undefined,
|
|
|
+ logingPublicKey:"",
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
@@ -114,6 +115,7 @@ export default {
|
|
|
if (this.captchaEnabled) {
|
|
|
this.codeUrl = "data:image/gif;base64," + res.img;
|
|
|
this.loginForm.uuid = res.uuid;
|
|
|
+ this.logingPublicKey = res.publicKeyString;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
@@ -140,7 +142,14 @@ export default {
|
|
|
Cookies.remove("password");
|
|
|
Cookies.remove('rememberMe');
|
|
|
}
|
|
|
- this.$store.dispatch("Login", this.loginForm).then(() => {
|
|
|
+
|
|
|
+ const new_loginForm = {...this.loginForm};
|
|
|
+ const new_password = this.loginForm.password;
|
|
|
+ new_loginForm.password = encryptString(new_password,this.logingPublicKey);
|
|
|
+ const new_username = this.loginForm.username;
|
|
|
+ new_loginForm.username = encryptString(new_username,this.logingPublicKey);
|
|
|
+
|
|
|
+ this.$store.dispatch("Login", new_loginForm).then(() => {
|
|
|
this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
|
|
|
}).catch(() => {
|
|
|
this.loading = false;
|