From 98928a4125c08a60f5be6febc5facbc2083f6a88 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Fri, 21 Jan 2022 12:51:30 -0500 Subject: [PATCH] fixups --- src/script/hydra-create-user | 6 ++++-- t/scripts/hydra-create-user.t | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/script/hydra-create-user b/src/script/hydra-create-user index 80873ca5..b9e376c8 100755 --- a/src/script/hydra-create-user +++ b/src/script/hydra-create-user @@ -33,6 +33,8 @@ renamed. Pass `--password-prompt` to collect the password on stdin. +The password will be hashed with Argon2id when stored. + Example: $ hydra-create-user alice --password-prompt --role admin @@ -94,7 +96,7 @@ my $userName = $ARGV[0]; my $chosenPasswordOptions = grep { defined($_) } ($passwordPrompt, $passwordHash, $password); if ($chosenPasswordOptions > 1) { - die "$0: please specify one of --password-prompt or --password-hash. See --help for more information.\n"; + die "$0: please specify only one of --password-prompt or --password-hash. See --help for more information.\n"; } die "$0: type must be `hydra', `google' or `github'\n" @@ -135,7 +137,7 @@ $db->txn_do(sub { } else { $user->update({ emailaddress => $emailAddress }) if defined $emailAddress; - if (defined $password && !(defined $passwordHash)) { + if (defined $password) { $user->setPassword($password); } diff --git a/t/scripts/hydra-create-user.t b/t/scripts/hydra-create-user.t index 4b382acd..a182cf11 100644 --- a/t/scripts/hydra-create-user.t +++ b/t/scripts/hydra-create-user.t @@ -76,7 +76,7 @@ subtest "Handling password and password hash creation" => sub { for my $case (@cases) { my ($res, $stdout, $stderr) = captureStdoutStderr(5, ( "hydra-create-user", "bogus-password-options", @{$case})); - like($stderr, qr/please specify one of --password-prompt or --password-hash/, "We get an error about specifying the password"); + like($stderr, qr/please specify only one of --password-prompt or --password-hash/, "We get an error about specifying the password"); isnt($res, 0, "hydra-create-user should exit non-zero with conflicting " . join(" ", @{$case})); } };