commit
This commit is contained in:
@@ -92,11 +92,35 @@
|
||||
<!-- import axios -->
|
||||
<script src="${base!}/assets/platform/plugins/axios/axios.js"></script>
|
||||
<!-- import Jquery -->
|
||||
<script src="${base!}/assets/platform/plugins/jquery/jquery.js"></script>
|
||||
<script src="${base!}/assets/platform/plugins/jquery/jquery-high.min.js"></script>
|
||||
<!-- import SM2 -->
|
||||
<script src="${base!}/assets/platform/plugins/sm-crypto/sm2.js"></script>
|
||||
<!-- import commonUtil -->
|
||||
<script src="${base!}/assets/platform/js/util/commonUtil.js"></script>
|
||||
<!-- import jsencrypt-->
|
||||
<script src="${base!}/assets/platform/plugins/jsencrypt/jsencrypt.min.js"></script>
|
||||
<script>
|
||||
// 安全地冻结 Object.prototype(跳过不可配置属性)
|
||||
(function () {
|
||||
const badKeys = ['__proto__', 'constructor', 'prototype'];
|
||||
for (const key of badKeys) {
|
||||
if (key in Object.prototype) {
|
||||
try {
|
||||
delete Object.prototype[key];
|
||||
} catch (e) {
|
||||
// 忽略无法删除的属性(如 __proto__ 在现代浏览器中不可删除)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 冻结 Object.prototype(如果可能)
|
||||
try {
|
||||
Object.freeze(Object.prototype);
|
||||
} catch (e) {
|
||||
// 忽略错误(某些环境可能不允许)
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
<script>
|
||||
new Vue({
|
||||
el: "#app",
|
||||
@@ -114,7 +138,11 @@
|
||||
password: [{ required: true, trigger: ["blur", "change"], message: "密码不能为空" }],
|
||||
platformCaptcha: [{ required: true, trigger: ["blur", "change"], message: "验证码不能为空" }]
|
||||
},
|
||||
loading: false
|
||||
loading: false,
|
||||
rasParams: {
|
||||
publicKey: '',
|
||||
keyId: '',
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -127,13 +155,20 @@
|
||||
})
|
||||
},
|
||||
handleLogin() {
|
||||
this.$refs.loginForm.validate((valid) => {
|
||||
this.$refs.loginForm.validate(async (valid) => {
|
||||
if (valid) {
|
||||
const { publicKey, keyId } = this.rasParams
|
||||
// 加密密码
|
||||
const encrypt = new JSEncrypt()
|
||||
encrypt.setPublicKey(publicKey)
|
||||
const encryptedPassword = encrypt.encrypt(this.loginForm.password)
|
||||
axios
|
||||
.post("/platform/login/doLogin", null, {
|
||||
params: {
|
||||
...this.loginForm,
|
||||
password: window.btoa(this.loginForm.password)
|
||||
//password: window.btoa(this.loginForm.password)
|
||||
password: encryptedPassword,
|
||||
keyId: keyId
|
||||
}
|
||||
})
|
||||
.then((resp) => {
|
||||
@@ -160,9 +195,16 @@
|
||||
console.log("cccccc")
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
// 获取公钥
|
||||
fetchPublicKey() {
|
||||
axios.get("/platform/login/publicKey").then(res => {
|
||||
this.rasParams = res.data.data
|
||||
})
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.fetchPublicKey()
|
||||
this.getCode()
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user