From 858cefc0c9c4514a9b15c73cd593a23afd5fef93 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=B1=9F=E6=9D=AD=E8=BE=89?= <jianghanghui@k.app>
Date: Wed, 22 Nov 2023 17:12:50 +0800
Subject: [PATCH] =?UTF-8?q?fix:=20mfa=E7=99=BB=E5=BD=95=E8=8F=9C=E5=8D=95?=
 =?UTF-8?q?=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 | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/frontend/src/views/login/components/login-form.vue b/frontend/src/views/login/components/login-form.vue
index 589253f56..5466ce542 100644
--- a/frontend/src/views/login/components/login-form.vue
+++ b/frontend/src/views/login/components/login-form.vue
@@ -189,6 +189,7 @@ const loginRules = reactive({
     password: computed(() => [{ required: true, message: i18n.global.t('commons.rule.password'), trigger: 'blur' }]),
 });
 
+let mfaIsLogin = false;
 const mfaButtonFocused = ref();
 const mfaLoginForm = reactive({
     name: '',
@@ -280,12 +281,17 @@ const login = (formEl: FormInstance | undefined) => {
 };
 
 const mfaLogin = async (auto: boolean) => {
+    if (mfaIsLogin) {
+        return;
+    }
+    mfaIsLogin = 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;
             return;
         }
         globalStore.setLogStatus(true);