Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions frontend/src/views/login/components/login-form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<div class="space-y-6 flex-grow">
<el-form-item>
<el-input
ref="mfaLoginRef"
size="large"
:placeholder="$t('commons.login.mfaCode')"
v-model.trim="mfaLoginForm.code"
Expand All @@ -27,7 +28,7 @@
<el-button
@focus="mfaButtonFocused = true"
@blur="mfaButtonFocused = false"
class="w-full"
class="w-full login-button"
type="primary"
@click="mfaLogin(false)"
>
Expand Down Expand Up @@ -181,7 +182,7 @@
</template>

<script setup lang="ts">
import { ref, reactive, onMounted, computed } from 'vue';
import { ref, reactive, onMounted, computed, nextTick } from 'vue';
import type { ElForm } from 'element-plus';
import { loginApi, getCaptcha, mfaLoginApi, getLoginSetting } from '@/api/modules/auth';
import { GlobalStore, MenuStore, TabsStore } from '@/store';
Expand Down Expand Up @@ -252,6 +253,7 @@ function checkAgreeLicense(rule: any, value: any, callback: any) {
}

let isLoggingIn = false;
const mfaLoginRef = ref();
const mfaButtonFocused = ref();
const mfaLoginForm = reactive({
name: '',
Expand Down Expand Up @@ -338,6 +340,9 @@ const login = (formEl: FormInstance | undefined) => {
if (res.data.mfaStatus === 'Enable') {
mfaShow.value = true;
errMfaInfo.value = false;
nextTick(() => {
mfaLoginRef.value?.focus();
});
return;
}
globalStore.setLogStatus(true);
Expand Down
Loading