Revert "Bug 28772: Update existing keys [STABLE]"

This reverts commit e5c4127e8e.
This commit is contained in:
Wainui Witika-Park 2021-09-20 09:02:26 +00:00
parent d13da9916e
commit 82d6494dc2
1 changed files with 0 additions and 29 deletions

View File

@ -1,29 +0,0 @@
$DBversion = 'XXX';
if( CheckVersion( $DBversion ) ) {
use Koha::AuthUtils qw(hash_password);
my $sth = $dbh->prepare(q{
SELECT client_id, secret
FROM api_keys
});
$sth->execute;
my $results = $sth->fetchall_arrayref({});
$sth = $dbh->prepare(q{
UPDATE api_keys
SET
secret = ?
WHERE
client_id = ?
});
foreach my $api_key (@$results) {
unless ( $api_key->{secret} =~ m/^\$2a\$08\$/ ) {
my $digest = Koha::AuthUtils::hash_password( $api_key->{secret} );
$sth->execute( $digest, $api_key->{client_id} );
}
}
NewVersion( $DBversion, 28772, "Store hashed API key secrets" );
}