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: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz>
This commit is contained in:
Tomas Cohen Arazi 2021-09-09 08:51:02 -03:00 committed by Wainui Witika-Park
parent 977a2327b1
commit 9e087c7c8e
1 changed files with 4 additions and 2 deletions

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