Add autofocus to 2FA input (#8766)

This commit is contained in:
Lucas Martins 2024-03-15 10:59:58 -03:00 committed by GitHub
parent bb244842fa
commit 7b02c4cc48
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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)