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

(-)a/Koha/REST/V1/Auth.pm (-5 / +6 lines)
Lines 530-543 sub _basic_auth { Link Here
530
        Koha::Exceptions::Authentication::Required->throw( error => 'Authentication failure.' );
530
        Koha::Exceptions::Authentication::Required->throw( error => 'Authentication failure.' );
531
    }
531
    }
532
532
533
    my $decoded_credentials = decode_base64( $credentials );
533
    my $decoded_credentials = decode_base64($credentials);
534
    my ( $user_id, $password ) = split( /:/, $decoded_credentials, 2 );
534
    my ( $identifier, $password ) = split( /:/, $decoded_credentials, 2 );
535
535
536
    unless ( checkpw_internal($user_id, $password ) ) {
536
    my $patron = Koha::Patrons->find( { userid => $identifier } );
537
    $patron //= Koha::Patrons->find( { cardnumber => $identifier } );
538
539
    unless ( checkpw_internal( $identifier, $password ) ) {
537
        Koha::Exceptions::Authorization::Unauthorized->throw( error => 'Invalid password' );
540
        Koha::Exceptions::Authorization::Unauthorized->throw( error => 'Invalid password' );
538
    }
541
    }
539
542
540
    my $patron = Koha::Patrons->find({ userid => $user_id });
541
    if ( $patron->password_expired ) {
543
    if ( $patron->password_expired ) {
542
        Koha::Exceptions::Authorization::Unauthorized->throw( error => 'Password has expired' );
544
        Koha::Exceptions::Authorization::Unauthorized->throw( error => 'Password has expired' );
543
    }
545
    }
544
- 

Return to bug 36420