mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 08:19:15 +08:00
fix: 修复登录菜单消失
This commit is contained in:
parent
858cefc0c9
commit
86e5fc36f4
@ -189,7 +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;
|
let isLoggingIn = false;
|
||||||
const mfaButtonFocused = ref();
|
const mfaButtonFocused = ref();
|
||||||
const mfaLoginForm = reactive({
|
const mfaLoginForm = reactive({
|
||||||
name: '',
|
name: '',
|
||||||
@ -224,7 +224,7 @@ function handleCommand(command: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const login = (formEl: FormInstance | undefined) => {
|
const login = (formEl: FormInstance | undefined) => {
|
||||||
if (!formEl) return;
|
if (!formEl || isLoggingIn) return;
|
||||||
formEl.validate(async (valid) => {
|
formEl.validate(async (valid) => {
|
||||||
if (!valid) return;
|
if (!valid) return;
|
||||||
let requestLoginForm = {
|
let requestLoginForm = {
|
||||||
@ -245,6 +245,7 @@ const login = (formEl: FormInstance | undefined) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
isLoggingIn = true;
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
const res = await loginApi(requestLoginForm);
|
const res = await loginApi(requestLoginForm);
|
||||||
if (res.code === 406) {
|
if (res.code === 406) {
|
||||||
@ -275,23 +276,24 @@ const login = (formEl: FormInstance | undefined) => {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
loginVerify();
|
loginVerify();
|
||||||
} finally {
|
} finally {
|
||||||
|
isLoggingIn = false;
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const mfaLogin = async (auto: boolean) => {
|
const mfaLogin = async (auto: boolean) => {
|
||||||
if (mfaIsLogin) {
|
if (isLoggingIn) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mfaIsLogin = true;
|
isLoggingIn = 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;
|
isLoggingIn = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
globalStore.setLogStatus(true);
|
globalStore.setLogStatus(true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user