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

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

Return to bug 36420