From 7b02c4cc482a97fe5efcf243a20f04769109e056 Mon Sep 17 00:00:00 2001 From: Lucas Martins <56271185+lucas-a-martins@users.noreply.github.com> Date: Fri, 15 Mar 2024 10:59:58 -0300 Subject: [PATCH] Add autofocus to 2FA input (#8766) --- ui/src/views/dashboard/VerifyTwoFa.vue | 11 +++++++++++ 1 file changed, 11 insertions(+) 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)