From aba131129334b8c51694fd25f9b851e5ca3b3dfe Mon Sep 17 00:00:00 2001 From: SkylerWallace Date: Mon, 2 Jun 2025 22:07:46 -0400 Subject: [PATCH] Fix SMS 2FA Resolve issue where using SMS 2FA resulted in script asking for 2FA code before 2FA code was sent to phone --- IdentityCommand/Private/Get-MechanismAnswer.ps1 | 4 ++-- IdentityCommand/Private/Start-AdvanceAuthentication.ps1 | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/IdentityCommand/Private/Get-MechanismAnswer.ps1 b/IdentityCommand/Private/Get-MechanismAnswer.ps1 index c41028c..c76234a 100644 --- a/IdentityCommand/Private/Get-MechanismAnswer.ps1 +++ b/IdentityCommand/Private/Get-MechanismAnswer.ps1 @@ -50,7 +50,7 @@ function Get-MechanismAnswer { switch ($Mechanism.Name) { - 'UP' { + { $PSItem -match 'UP|SMS' } { #User Password already provided via Credential $Answer = $Credential.Password @@ -94,7 +94,7 @@ function Get-MechanismAnswer { } - { $PSItem -match 'SMS|OATH' } { + { $PSItem -match 'OATH' } { #Prompt for TOTP/SMS code input $Answer = Read-Host -Prompt $($Mechanism.PromptMechChosen) -AsSecureString diff --git a/IdentityCommand/Private/Start-AdvanceAuthentication.ps1 b/IdentityCommand/Private/Start-AdvanceAuthentication.ps1 index 62de757..1ffe98d 100644 --- a/IdentityCommand/Private/Start-AdvanceAuthentication.ps1 +++ b/IdentityCommand/Private/Start-AdvanceAuthentication.ps1 @@ -94,6 +94,10 @@ Function Start-AdvanceAuthentication { break } + { $PSItem.Name -match 'SMS' } { + $Answer = Read-Host -Prompt $($Mechanism.PromptMechChosen) -AsSecureString + } + { $($PSItem.Name) -match 'SQ|UP|OATH|SMS|RESET' } { #Provide Answer Directly