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