Skip to content

Commit 512a926

Browse files
committed
fix: add loader for the 2fa confirmation
1 parent dba8c65 commit 512a926

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

custom/TwoFactorsConfirmation.vue

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@
143143
await isCMAAvailable();
144144
tagOtpInputs();
145145
if (isPasskeysSupported.value === true) {
146-
checkIfUserHasPasskeys();
146+
await checkIfUserHasPasskeys();
147147
}
148148
document.addEventListener('focusin', handleGlobalFocusIn, true);
149149
focusFirstAvailableOtpInput();
@@ -219,21 +219,25 @@
219219
}
220220
}
221221
222-
function checkIfUserHasPasskeys() {
223-
callAdminForthApi({
224-
method: 'POST',
225-
path: '/plugin/passkeys/checkIfUserHasPasskeys',
226-
}).then((response) => {
227-
if (response.ok) {
228-
doesUserHavePasskeys.value = response.hasPasskeys;
229-
if ( doesUserHavePasskeys.value === true ) {
230-
router.push({ hash: '#passkey' })
231-
confirmationMode.value = 'passkey';
232-
} else {
233-
router.push({ hash: '#code' })
222+
async function checkIfUserHasPasskeys() {
223+
try {
224+
await callAdminForthApi({
225+
method: 'POST',
226+
path: '/plugin/passkeys/checkIfUserHasPasskeys',
227+
}).then(async (response) => {
228+
if (response.ok) {
229+
doesUserHavePasskeys.value = response.hasPasskeys;
230+
if ( doesUserHavePasskeys.value === true ) {
231+
router.push({ hash: '#passkey' })
232+
confirmationMode.value = 'passkey';
233+
} else {
234+
router.push({ hash: '#code' })
235+
}
234236
}
235-
}
236-
});
237+
});
238+
} catch (error) {
239+
console.error('Error checking if user has passkeys:', error);
240+
}
237241
}
238242
239243
async function usePasskeyButton() {

0 commit comments

Comments
 (0)