1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-31 22:18:07 +08:00

fix: mfa登录菜单消失

This commit is contained in:
江杭辉 2023-11-22 17:12:50 +08:00 committed by ssongliu
parent 5e1ad4b3a1
commit 5127fec4b3

View File

@ -189,6 +189,7 @@ const loginRules = reactive({
password: computed(() => [{ required: true, message: i18n.global.t('commons.rule.password'), trigger: 'blur' }]), password: computed(() => [{ required: true, message: i18n.global.t('commons.rule.password'), trigger: 'blur' }]),
}); });
let mfaIsLogin = false;
const mfaButtonFocused = ref(); const mfaButtonFocused = ref();
const mfaLoginForm = reactive({ const mfaLoginForm = reactive({
name: '', name: '',
@ -280,12 +281,17 @@ const login = (formEl: FormInstance | undefined) => {
}; };
const mfaLogin = async (auto: boolean) => { const mfaLogin = async (auto: boolean) => {
if (mfaIsLogin) {
return;
}
mfaIsLogin = true;
if ((!auto && mfaLoginForm.code) || (auto && mfaLoginForm.code.length === 6)) { if ((!auto && mfaLoginForm.code) || (auto && mfaLoginForm.code.length === 6)) {
mfaLoginForm.name = loginForm.name; mfaLoginForm.name = loginForm.name;
mfaLoginForm.password = loginForm.password; mfaLoginForm.password = loginForm.password;
const res = await mfaLoginApi(mfaLoginForm); const res = await mfaLoginApi(mfaLoginForm);
if (res.code === 406) { if (res.code === 406) {
errMfaInfo.value = true; errMfaInfo.value = true;
mfaIsLogin = false;
return; return;
} }
globalStore.setLogStatus(true); globalStore.setLogStatus(true);