Skip to content

Commit e7e53da

Browse files
lucas-a-martinsdhslove
authored andcommitted
Add autofocus to 2FA input (apache#8766)
1 parent a4d73d6 commit e7e53da

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

ui/src/views/dashboard/VerifyTwoFa.vue

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ export default {
7575
created () {
7676
this.initForm()
7777
},
78+
mounted () {
79+
this.$nextTick(() => {
80+
this.focusInput()
81+
})
82+
},
7883
methods: {
7984
initForm () {
8085
this.formRef = ref()
@@ -83,6 +88,12 @@ export default {
8388
code: [{ required: true, message: this.$t('message.error.authentication.code') }]
8489
})
8590
},
91+
focusInput () {
92+
const inputElement = this.$refs.code.$el.querySelector('input[type=password]')
93+
if (inputElement) {
94+
inputElement.focus()
95+
}
96+
},
8697
handleSubmit () {
8798
this.formRef.value.validate().then(() => {
8899
const values = toRaw(this.form)

0 commit comments

Comments
 (0)