From 76fbde6d6b45415b004c2468973da0cff2f3576f Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Fri, 21 Jan 2022 11:11:09 -0500 Subject: [PATCH] Set noecho when reading passwords --- flake.nix | 1 + src/script/hydra-create-user | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 43cce4bd..49f2f7a7 100644 --- a/flake.nix +++ b/flake.nix @@ -495,6 +495,7 @@ StringCompareConstantTime SysHostnameLong TermSizeAny + TermReadKey Test2Harness TestMore TestPostgreSQL diff --git a/src/script/hydra-create-user b/src/script/hydra-create-user index 839f742b..80873ca5 100755 --- a/src/script/hydra-create-user +++ b/src/script/hydra-create-user @@ -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 = // ""; chomp $password; - print STDERR "Password Confirmation: "; + print STDERR "\nPassword Confirmation: "; my $passwordConfirm = // ""; chomp $passwordConfirm; + ReadMode 0; + + print STDERR "\n"; if ($password ne $passwordConfirm) { die "Passwords don't match."