Fix secure password prompt binding in deploy script

This commit is contained in:
2026-02-02 16:52:26 +01:00
parent 2d2d4f0c84
commit c1e1689a55

View File

@@ -50,15 +50,15 @@ Assert-Tool $WinScpPath
function Read-PlainOrPrompt([string]$Value, [string]$Prompt, [switch]$Secure) {
if ($Value) { return $Value }
if ($Secure) {
$secure = Read-Host -AsSecureString $Prompt
$secure = Read-Host -Prompt $Prompt -AsSecureString
return [Runtime.InteropServices.Marshal]::PtrToStringUni(
[Runtime.InteropServices.Marshal]::SecureStringToBSTR($secure)
)
}
return Read-Host $Prompt
return Read-Host -Prompt $Prompt
}
$FtpPassword = Read-PlainOrPrompt $FtpPassword "FTP password"
$FtpPassword = Read-PlainOrPrompt $FtpPassword "FTP password" -Secure
$WinRmCredentialPass = Read-PlainOrPrompt $WinRmCredentialPass "WinRM password" -Secure
Write-Host "1) Publishing..." -ForegroundColor Cyan