diff --git a/packages/core/src/auth/credentials/utils.ts b/packages/core/src/auth/credentials/utils.ts index 28fa5df1c4c..885a4fb1f87 100644 --- a/packages/core/src/auth/credentials/utils.ts +++ b/packages/core/src/auth/credentials/utils.ts @@ -14,8 +14,9 @@ import { messages, showMessageWithCancel, showViewLogsMessage } from '../../shar import { Timeout, waitTimeout } from '../../shared/utilities/timeoutUtils' import { fromExtensionManifest } from '../../shared/settings' import { Profile } from './sharedCredentials' -import { createInputBox, promptUser } from '../../shared/ui/input' import { openUrl } from '../../shared/utilities/vsCodeUtils' +import { createInputBox } from '../../shared/ui/inputPrompter' +import { isValidResponse } from '../../shared/wizards/wizard' const credentialsTimeout = 300000 // 5 minutes const credentialsProgressDelay = 1000 @@ -113,18 +114,16 @@ const errorMessageUserCancelled = localize('AWS.error.mfa.userCancelled', 'User */ export async function getMfaTokenFromUser(mfaSerial: string, profileName: string): Promise { const inputBox = createInputBox({ - options: { - ignoreFocusOut: true, - placeHolder: localize('AWS.prompt.mfa.enterCode.placeholder', 'Enter Authentication Code Here'), - title: localize('AWS.prompt.mfa.enterCode.title', 'MFA Challenge for {0}', profileName), - prompt: localize('AWS.prompt.mfa.enterCode.prompt', 'Enter code for MFA device {0}', mfaSerial), - }, + ignoreFocusOut: true, + placeholder: localize('AWS.prompt.mfa.enterCode.placeholder', 'Enter Authentication Code Here'), + title: localize('AWS.prompt.mfa.enterCode.title', 'MFA Challenge for {0}', profileName), + prompt: localize('AWS.prompt.mfa.enterCode.prompt', 'Enter code for MFA device {0}', mfaSerial), }) - const token = await promptUser({ inputBox: inputBox }) + const token = await inputBox.prompt() // Distinguish user cancel vs code entry issues with the error message - if (!token) { + if (!isValidResponse(token)) { throw new Error(errorMessageUserCancelled) }