1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-19 08:19:15 +08:00

feat: 优化 mfa 登陆方式 (#2605)

Refs #1884
This commit is contained in:
ssongliu 2023-10-19 21:52:44 +08:00 committed by GitHub
parent 8bb07cf4f5
commit 581ed16b73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,6 +9,7 @@
size="default"
:placeholder="$t('commons.login.mfaCode')"
v-model.trim="mfaLoginForm.code"
@input="mfaLogin(true)"
>
<template #prefix>
<el-icon class="el-input__icon">
@ -28,7 +29,7 @@
type="primary"
size="default"
round
@click="mfaLogin()"
@click="mfaLogin(false)"
>
{{ $t('commons.button.verify') }}
</el-button>
@ -278,8 +279,8 @@ const login = (formEl: FormInstance | undefined) => {
});
};
const mfaLogin = async () => {
if (mfaLoginForm.code) {
const mfaLogin = async (auto: boolean) => {
if ((!auto && mfaLoginForm.code) || (auto && mfaLoginForm.code.length === 6)) {
mfaLoginForm.name = loginForm.name;
mfaLoginForm.password = loginForm.password;
const res = await mfaLoginApi(mfaLoginForm);
@ -328,7 +329,7 @@ onMounted(() => {
}
}
if (mfaShow.value && !mfaButtonFocused.value) {
mfaLogin();
mfaLogin(false);
}
}
};