feat: enhance MFA retry logic with configurable options (#1441)

This commit is contained in:
Ralph Khreish
2025-11-24 21:53:14 +01:00
committed by GitHub
parent 72e2c399d4
commit 0195feffee
3 changed files with 169 additions and 15 deletions

View File

@@ -603,7 +603,7 @@ Examples:
error.name === 'ExitPromptError' ||
error.message?.includes('force closed')
) {
ui.displayWarning('\nMFA verification cancelled by user');
ui.displayWarning(' MFA verification cancelled by user');
throw new AuthenticationError(
'MFA verification cancelled',
'MFA_VERIFICATION_FAILED'
@@ -612,7 +612,15 @@ Examples:
throw error;
}
},
3 // Max attempts
{
maxAttempts: 3,
onInvalidCode: (_attempt: number, remaining: number) => {
// Callback invoked when invalid code is entered
if (remaining > 0) {
ui.displayError(`Invalid MFA code. Please try again.`);
}
}
}
);
// Handle result from core