automatically focus to the passcode input when a passcode is required
This commit is contained in:
@@ -108,9 +108,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { VTextField } from 'vuetify/components/VTextField';
|
||||||
import SnackBar from '@/components/desktop/SnackBar.vue';
|
import SnackBar from '@/components/desktop/SnackBar.vue';
|
||||||
|
|
||||||
import { ref, computed, useTemplateRef } from 'vue';
|
import { ref, computed, useTemplateRef, nextTick } from 'vue';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { useTheme } from 'vuetify';
|
import { useTheme } from 'vuetify';
|
||||||
|
|
||||||
@@ -164,6 +165,7 @@ const {
|
|||||||
doAfterLogin
|
doAfterLogin
|
||||||
} = useLoginPageBase('desktop');
|
} = useLoginPageBase('desktop');
|
||||||
|
|
||||||
|
const passcodeInput = useTemplateRef<VTextField>('passcodeInput');
|
||||||
const snackbar = useTemplateRef<SnackBarType>('snackbar');
|
const snackbar = useTemplateRef<SnackBarType>('snackbar');
|
||||||
|
|
||||||
const passcode = ref<string>('');
|
const passcode = ref<string>('');
|
||||||
@@ -225,6 +227,14 @@ function verifyAndLogin(): void {
|
|||||||
return;
|
return;
|
||||||
} else if (error.error && error.error.errorCode === KnownErrorCode.TwoFactorAuthorizationPasscodeEmpty) {
|
} else if (error.error && error.error.errorCode === KnownErrorCode.TwoFactorAuthorizationPasscodeEmpty) {
|
||||||
show2faInput.value = true;
|
show2faInput.value = true;
|
||||||
|
|
||||||
|
nextTick(() => {
|
||||||
|
if (passcodeInput.value) {
|
||||||
|
passcodeInput.value.focus();
|
||||||
|
passcodeInput.value.select();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user