This commit is contained in:
Graham Christensen 2022-01-21 12:51:30 -05:00
parent 76fbde6d6b
commit 98928a4125
2 changed files with 5 additions and 3 deletions

View file

@ -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);
}

View file

@ -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}));
}
};