hydra-create-user: re-hash sha1 as Argon2

This commit is contained in:
Graham Christensen
2021-04-16 11:28:00 -04:00
parent d10d8964f2
commit 79b0ddc27d
4 changed files with 90 additions and 1 deletions

View File

@ -258,4 +258,15 @@ sub setPassword {
});
}
sub setPasswordHash {
my ($self, $passwordHash) = @_;;
if ($passwordHash =~ /^[a-f0-9]{40}$/) {
# This is (probably) a sha1 password, re-hash it and we'll check for a hashed sha1 in Users.pm
$self->setPassword($passwordHash);
} else {
$self->update({ password => $passwordHash });
}
}
1;

View File

@ -109,7 +109,10 @@ $db->txn_do(sub {
if (defined $password && !(defined $passwordHash)) {
$user->setPassword($password);
}
$user->update({ password => $passwordHash }) if defined $passwordHash;
if (defined $passwordHash) {
$user->setPasswordHash($passwordHash);
}
}
$user->userroles->delete if $wipeRoles;