Bug 28772: Do not hash secrets twice

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Tomás Cohen Arazi 2021-09-09 08:51:02 -03:00 committed by Kyle M Hall
parent 07eff56a73
commit 6c3951d414

View file

@ -25,8 +25,10 @@ return {
});
foreach my $api_key (@$results) {
my $digest = Koha::AuthUtils::hash_password( $api_key->{secret} );
$sth->execute( $digest, $api_key->{client_id} );
unless ( $api_key->{secret} =~ m/^\$2a\$08\$/ ) {
my $digest = Koha::AuthUtils::hash_password( $api_key->{secret} );
$sth->execute( $digest, $api_key->{client_id} );
}
}
},
}