mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Add autofocus to 2FA input (#8766)
This commit is contained in:
parent
bb244842fa
commit
7b02c4cc48
@ -71,6 +71,11 @@ export default {
|
|||||||
created () {
|
created () {
|
||||||
this.initForm()
|
this.initForm()
|
||||||
},
|
},
|
||||||
|
mounted () {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.focusInput()
|
||||||
|
})
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
initForm () {
|
initForm () {
|
||||||
this.formRef = ref()
|
this.formRef = ref()
|
||||||
@ -79,6 +84,12 @@ export default {
|
|||||||
code: [{ required: true, message: this.$t('message.error.authentication.code') }]
|
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 () {
|
handleSubmit () {
|
||||||
this.formRef.value.validate().then(() => {
|
this.formRef.value.validate().then(() => {
|
||||||
const values = toRaw(this.form)
|
const values = toRaw(this.form)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user