From a46d29cc37b6600bcc6bd054411c0cc7dfcd6a86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=9F=E6=9D=AD=E8=BE=89?= Date: Wed, 22 Nov 2023 17:27:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E6=B6=88=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/login/components/login-form.vue | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/frontend/src/views/login/components/login-form.vue b/frontend/src/views/login/components/login-form.vue index 5466ce542..b115763fa 100644 --- a/frontend/src/views/login/components/login-form.vue +++ b/frontend/src/views/login/components/login-form.vue @@ -189,7 +189,7 @@ const loginRules = reactive({ password: computed(() => [{ required: true, message: i18n.global.t('commons.rule.password'), trigger: 'blur' }]), }); -let mfaIsLogin = false; +let isLoggingIn = false; const mfaButtonFocused = ref(); const mfaLoginForm = reactive({ name: '', @@ -224,7 +224,7 @@ function handleCommand(command: string) { } const login = (formEl: FormInstance | undefined) => { - if (!formEl) return; + if (!formEl || isLoggingIn) return; formEl.validate(async (valid) => { if (!valid) return; let requestLoginForm = { @@ -245,6 +245,7 @@ const login = (formEl: FormInstance | undefined) => { return; } try { + isLoggingIn = true; loading.value = true; const res = await loginApi(requestLoginForm); if (res.code === 406) { @@ -275,23 +276,24 @@ const login = (formEl: FormInstance | undefined) => { } catch (error) { loginVerify(); } finally { + isLoggingIn = false; loading.value = false; } }); }; const mfaLogin = async (auto: boolean) => { - if (mfaIsLogin) { + if (isLoggingIn) { return; } - mfaIsLogin = true; + isLoggingIn = true; if ((!auto && mfaLoginForm.code) || (auto && mfaLoginForm.code.length === 6)) { mfaLoginForm.name = loginForm.name; mfaLoginForm.password = loginForm.password; const res = await mfaLoginApi(mfaLoginForm); if (res.code === 406) { errMfaInfo.value = true; - mfaIsLogin = false; + isLoggingIn = false; return; } globalStore.setLogStatus(true);