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

(-)a/Koha/Patron.pm (-2 / +3 lines)
Lines 2061-2068 sub account_locked { Link Here
2061
    my $FailedLoginAttempts = C4::Context->preference('FailedLoginAttempts');
2061
    my $FailedLoginAttempts = C4::Context->preference('FailedLoginAttempts');
2062
    return 1
2062
    return 1
2063
        if $FailedLoginAttempts
2063
        if $FailedLoginAttempts
2064
        and $self->login_attempts
2064
        && $FailedLoginAttempts > 0
2065
        and $self->login_attempts >= $FailedLoginAttempts;
2065
        && $self->login_attempts
2066
        && $self->login_attempts >= $FailedLoginAttempts;
2066
    return 1 if ( $self->login_attempts || 0 ) < 0;    # administrative lockout
2067
    return 1 if ( $self->login_attempts || 0 ) < 0;    # administrative lockout
2067
    return 0;
2068
    return 0;
2068
}
2069
}
(-)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