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

(-)a/Koha/Patron.pm (-2 / +3 lines)
Lines 2154-2161 sub account_locked { Link Here
2154
    my $FailedLoginAttempts = C4::Context->preference('FailedLoginAttempts');
2154
    my $FailedLoginAttempts = C4::Context->preference('FailedLoginAttempts');
2155
    return 1
2155
    return 1
2156
        if $FailedLoginAttempts
2156
        if $FailedLoginAttempts
2157
        and $self->login_attempts
2157
        && $FailedLoginAttempts > 0
2158
        and $self->login_attempts >= $FailedLoginAttempts;
2158
        && $self->login_attempts
2159
        && $self->login_attempts >= $FailedLoginAttempts;
2159
    return 1 if ( $self->login_attempts || 0 ) < 0;    # administrative lockout
2160
    return 1 if ( $self->login_attempts || 0 ) < 0;    # administrative lockout
2160
    return 0;
2161
    return 0;
2161
}
2162
}
(-)a/Koha/Patrons.pm (-3 / +5 lines)
Lines 305-314 sub search_anonymize_candidates { Link Here
305
    my $str    = $parser->format_datetime($dt);
305
    my $str    = $parser->format_datetime($dt);
306
    $cond->{dateexpiry} = { '<=' => $str };
306
    $cond->{dateexpiry} = { '<=' => $str };
307
    $cond->{anonymized} = 0;                  # not yet done
307
    $cond->{anonymized} = 0;                  # not yet done
308
    if ( $params->{locked} ) {
308
    my $fails = C4::Context->preference('FailedLoginAttempts');
309
        my $fails = C4::Context->preference('FailedLoginAttempts') || 0;
309
310
    if ( $params->{locked} && $fails && $fails > 0 ) {    # $fails should actually not be negative btw
310
        $cond->{login_attempts} =
311
        $cond->{login_attempts} =
311
            [ -and => { '!=' => undef }, { -not_in => [ 0, 1 .. $fails - 1 ] } ];    # -not_in does not like undef
312
            [ -and => { '!=' => undef }, { -not_in => [ 0, 1 .. $fails - 1 ] } ];    # -not_in does not like undef
313
    } elsif ( $params->{locked} ) {
314
        $cond->{login_attempts} = -1;
312
    }
315
    }
313
    return $class->search($cond);
316
    return $class->search($cond);
314
}
317
}
315
- 

Return to bug 41094