Set noecho when reading passwords

This commit is contained in:
Graham Christensen 2022-01-21 11:11:09 -05:00
parent bb893d0bd5
commit 76fbde6d6b
2 changed files with 7 additions and 1 deletions

View file

@ -495,6 +495,7 @@
StringCompareConstantTime
SysHostnameLong
TermSizeAny
TermReadKey
Test2Harness
TestMore
TestPostgreSQL

View file

@ -5,6 +5,7 @@ use warnings;
use Hydra::Schema;
use Hydra::Helper::Nix;
use Hydra::Model::DB;
use Term::ReadKey;
use Getopt::Long qw(:config gnu_getopt);
sub showHelp {
@ -143,13 +144,17 @@ $db->txn_do(sub {
}
if (defined $passwordPrompt) {
ReadMode 2;
print STDERR "Password: ";
my $password = <STDIN> // "";
chomp $password;
print STDERR "Password Confirmation: ";
print STDERR "\nPassword Confirmation: ";
my $passwordConfirm = <STDIN> // "";
chomp $passwordConfirm;
ReadMode 0;
print STDERR "\n";
if ($password ne $passwordConfirm) {
die "Passwords don't match."