View | Details | Raw Unified | Return to bug 28772
Collapse All | Expand All

(-)a/Koha/ApiKey.pm (-1 / +1 lines)
Lines 80-86 sub validate_secret { Link Here
80
80
81
    my $digest = Koha::AuthUtils::hash_password( $secret, $self->secret );
81
    my $digest = Koha::AuthUtils::hash_password( $secret, $self->secret );
82
82
83
    return $self->secret eq $digest;
83
    return ( $self->secret eq $digest ) ? 1 : 0;
84
}
84
}
85
85
86
=head3 plain_text_secret
86
=head3 plain_text_secret
(-)a/t/db_dependent/Koha/ApiKey.t (-3 / +2 lines)
Lines 130-137 subtest 'validate_secret() tests' => sub { Link Here
130
130
131
    my $secret = $api_key->plain_text_secret;
131
    my $secret = $api_key->plain_text_secret;
132
132
133
    ok( $api_key->validate_secret( $secret ), 'Valid secret returns true' );
133
    is( $api_key->validate_secret( $secret ), 1, 'Valid secret returns true' );
134
    ok( !$api_key->validate_secret( 'Wrong secret' ), 'Invalid secret returns false' );
134
    is( $api_key->validate_secret( 'Wrong secret' ), 0, 'Invalid secret returns false' );
135
135
136
    $schema->storage->txn_rollback;
136
    $schema->storage->txn_rollback;
137
};
137
};
138
- 

Return to bug 28772