mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-21 07:10:15 -05:00
Add secure prompt to install Wizard
This commit is contained in:
parent
7c54096c94
commit
1858f93c74
1 changed files with 9 additions and 3 deletions
|
|
@ -280,7 +280,8 @@ function Get-IcingaAgentInstallerAnswerInput()
|
|||
param(
|
||||
$Prompt,
|
||||
[ValidateSet("y","n","v")]
|
||||
$Default
|
||||
$Default,
|
||||
[switch]$Secure
|
||||
);
|
||||
|
||||
$DefaultAnswer = '';
|
||||
|
|
@ -291,10 +292,15 @@ function Get-IcingaAgentInstallerAnswerInput()
|
|||
$DefaultAnswer = ' (y/N)';
|
||||
}
|
||||
|
||||
$answer = Read-Host -Prompt ([string]::Format('{0}{1}', $Prompt, $DefaultAnswer));
|
||||
$answer = $answer.ToLower();
|
||||
if (-Not $Secure) {
|
||||
$answer = Read-Host -Prompt ([string]::Format('{0}{1}', $Prompt, $DefaultAnswer));
|
||||
} else {
|
||||
$answer = Read-Host -Prompt ([string]::Format('{0}{1}', $Prompt, $DefaultAnswer)) -AsSecureString;
|
||||
}
|
||||
|
||||
if ($Default -ne 'v') {
|
||||
$answer = $answer.ToLower();
|
||||
|
||||
$returnValue = 0;
|
||||
if ([string]::IsNullOrEmpty($answer) -Or $answer -eq $Default) {
|
||||
$returnValue = 1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue