forked from lix-project/hydra
fixups
This commit is contained in:
parent
76fbde6d6b
commit
98928a4125
2 changed files with 5 additions and 3 deletions
|
@ -33,6 +33,8 @@ renamed.
|
||||||
|
|
||||||
Pass `--password-prompt` to collect the password on stdin.
|
Pass `--password-prompt` to collect the password on stdin.
|
||||||
|
|
||||||
|
The password will be hashed with Argon2id when stored.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
$ hydra-create-user alice --password-prompt --role admin
|
$ hydra-create-user alice --password-prompt --role admin
|
||||||
|
@ -94,7 +96,7 @@ my $userName = $ARGV[0];
|
||||||
|
|
||||||
my $chosenPasswordOptions = grep { defined($_) } ($passwordPrompt, $passwordHash, $password);
|
my $chosenPasswordOptions = grep { defined($_) } ($passwordPrompt, $passwordHash, $password);
|
||||||
if ($chosenPasswordOptions > 1) {
|
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"
|
die "$0: type must be `hydra', `google' or `github'\n"
|
||||||
|
@ -135,7 +137,7 @@ $db->txn_do(sub {
|
||||||
} else {
|
} else {
|
||||||
$user->update({ emailaddress => $emailAddress }) if defined $emailAddress;
|
$user->update({ emailaddress => $emailAddress }) if defined $emailAddress;
|
||||||
|
|
||||||
if (defined $password && !(defined $passwordHash)) {
|
if (defined $password) {
|
||||||
$user->setPassword($password);
|
$user->setPassword($password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ subtest "Handling password and password hash creation" => sub {
|
||||||
for my $case (@cases) {
|
for my $case (@cases) {
|
||||||
my ($res, $stdout, $stderr) = captureStdoutStderr(5, (
|
my ($res, $stdout, $stderr) = captureStdoutStderr(5, (
|
||||||
"hydra-create-user", "bogus-password-options", @{$case}));
|
"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}));
|
isnt($res, 0, "hydra-create-user should exit non-zero with conflicting " . join(" ", @{$case}));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue