mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-09-05 06:04:35 +08:00
feat: MFA verification code automatically obtains focus (#10213)
refs #8032
This commit is contained in:
parent
29306827ba
commit
f62ce085bf
1 changed files with 7 additions and 2 deletions
|
@ -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"
|
||||
|
@ -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)"
|
||||
>
|
||||
|
@ -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';
|
||||
|
@ -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: '',
|
||||
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue