diff --git a/ui/src/views/dashboard/VerifyTwoFa.vue b/ui/src/views/dashboard/VerifyTwoFa.vue index 6456bf203fc..0d6ec52b87e 100644 --- a/ui/src/views/dashboard/VerifyTwoFa.vue +++ b/ui/src/views/dashboard/VerifyTwoFa.vue @@ -71,6 +71,11 @@ export default { created () { this.initForm() }, + mounted () { + this.$nextTick(() => { + this.focusInput() + }) + }, methods: { initForm () { this.formRef = ref() @@ -79,6 +84,12 @@ export default { code: [{ required: true, message: this.$t('message.error.authentication.code') }] }) }, + focusInput () { + const inputElement = this.$refs.code.$el.querySelector('input[type=password]') + if (inputElement) { + inputElement.focus() + } + }, handleSubmit () { this.formRef.value.validate().then(() => { const values = toRaw(this.form)