Skip to content

Commit 2b166b6

Browse files
committed
fix: improve error handling for passkey and code validation
1 parent 6e0cd60 commit 2b166b6

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

custom/TwoFactorsConfirmation.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,11 @@
179179
await user.finishLogin();
180180
} else {
181181
if (usePasskey) {
182-
showErrorTost(t('Invalid passkey'));
183-
codeError.value = 'Invalid passkey';
182+
showErrorTost(t(resp.error));
183+
codeError.value = resp.error || t('Passkey authentication failed');
184184
} else {
185185
showErrorTost(t(resp.error));
186-
codeError.value = resp.error;
186+
codeError.value = resp.error || t('Invalid code');
187187
}
188188
}
189189
}

custom/TwoFactorsSetup.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ async function sendCode (value) {
241241
}
242242
await user.finishLogin();
243243
} else {
244-
codeError.value = 'Invalid code';
244+
codeError.value = resp.error || t('Invalid code');
245245
}
246246
}
247247

index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
340340
}
341341
const decodedPasskeysCookies = await this.adminforth.auth.verify(passkeysCookies, 'tempPasskeyChallenge', false);
342342
if (!decodedPasskeysCookies) {
343-
return { error: 'Invalid passkey token' };
343+
return { error: 'Invalid passkey' };
344344
}
345345
const res = await this.verifyPasskeyResponse(body.passkeyOptions, decoded.pk, decodedPasskeysCookies);
346346
if (res.ok && res.passkeyConfirmed) {

0 commit comments

Comments
 (0)