Skip to content

Commit 7b02c4c

Browse files
Add autofocus to 2FA input (#8766)
1 parent bb24484 commit 7b02c4c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

ui/src/views/dashboard/VerifyTwoFa.vue

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ export default {
7171
created () {
7272
this.initForm()
7373
},
74+
mounted () {
75+
this.$nextTick(() => {
76+
this.focusInput()
77+
})
78+
},
7479
methods: {
7580
initForm () {
7681
this.formRef = ref()
@@ -79,6 +84,12 @@ export default {
7984
code: [{ required: true, message: this.$t('message.error.authentication.code') }]
8085
})
8186
},
87+
focusInput () {
88+
const inputElement = this.$refs.code.$el.querySelector('input[type=password]')
89+
if (inputElement) {
90+
inputElement.focus()
91+
}
92+
},
8293
handleSubmit () {
8394
this.formRef.value.validate().then(() => {
8495
const values = toRaw(this.form)

0 commit comments

Comments
 (0)