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

(-)a/members/member-password.pl (-2 / +1 lines)
Lines 82-90 if ( $op eq 'cud-update' && defined($newpassword) and not @errors ) { Link Here
82
        } elsif ( $_->isa('Koha::Exceptions::Password::Plugin') ) {
82
        } elsif ( $_->isa('Koha::Exceptions::Password::Plugin') ) {
83
            push @errors, 'ERROR_from_plugin';
83
            push @errors, 'ERROR_from_plugin';
84
        } elsif ( $_->isa('Koha::Exceptions::Password::UsedBefore') ) {
84
        } elsif ( $_->isa('Koha::Exceptions::Password::UsedBefore') ) {
85
            my $count = C4::Context->preference('PasswordHistoryCount') || 0;
86
            push @errors, 'ERROR_password_used_before';
85
            push @errors, 'ERROR_password_used_before';
87
            $template->param( 'password_history_count' => $count );
86
            $template->param( 'password_history_count' => $patron->category->effective_password_history_count );
88
        } else {
87
        } else {
89
            push( @errors, 'BADUSERID' );
88
            push( @errors, 'BADUSERID' );
90
        }
89
        }
(-)a/members/memberentry.pl (-11 / +12 lines)
Lines 392-410 if ( $op eq 'cud-save' || $op eq 'cud-insert' ) { Link Here
392
            push @errors, 'ERROR_password_too_weak'        if $error eq 'too_weak';
392
            push @errors, 'ERROR_password_too_weak'        if $error eq 'too_weak';
393
            push @errors, 'ERROR_password_has_whitespaces' if $error eq 'has_whitespaces';
393
            push @errors, 'ERROR_password_has_whitespaces' if $error eq 'has_whitespaces';
394
        }
394
        }
395
        
395
396
        # Check password history
396
        # Check password history
397
        if ($patron && $is_valid) {  # Only check if other validations passed and we have a patron
397
        if ( $patron && $is_valid ) {    # Only check if other validations passed and we have a patron
398
            my $is_used = Koha::PatronPasswordHistories->has_used_password({
398
            my $is_used = Koha::PatronPasswordHistories->has_used_password(
399
                borrowernumber => $patron->borrowernumber,
399
                {
400
                password => $password,
400
                    borrowernumber   => $patron->borrowernumber,
401
                current_password => $patron->password
401
                    password         => $password,
402
            });
402
                    current_password => $patron->password
403
            
403
                }
404
            );
405
404
            if ($is_used) {
406
            if ($is_used) {
405
                push @errors, 'ERROR_password_used_before';
407
                push @errors, 'ERROR_password_used_before';
406
                my $count = C4::Context->preference('PasswordHistoryCount') || 0;
408
                $template->param( password_history_count => $patron->category->effective_password_history_count );
407
                $template->param( password_history_count => $count );
408
            }
409
            }
409
        }
410
        }
410
    }
411
    }
Lines 627-633 if ( ( !$nok ) and $nodouble and ( $op eq 'cud-insert' or $op eq 'cud-save' ) ) Link Here
627
                }
628
                }
628
            }
629
            }
629
630
630
            # password validity has been checked above 
631
            # password validity has been checked above
631
            my $password = $newdata{password};
632
            my $password = $newdata{password};
632
            if ( $password and $password ne '****' and $success ) {
633
            if ( $password and $password ne '****' and $success ) {
633
                $patron->set_password( { password => $password } );
634
                $patron->set_password( { password => $password } );
(-)a/opac/opac-passwd.pl (-2 / +3 lines)
Lines 68-76 if ( $patron->category->effective_change_password ) { Link Here
68
                        if $_->isa('Koha::Exceptions::Password::TooWeak');
68
                        if $_->isa('Koha::Exceptions::Password::TooWeak');
69
                    $error = 'password_has_whitespaces'
69
                    $error = 'password_has_whitespaces'
70
                        if $_->isa('Koha::Exceptions::Password::WhitespaceCharacters');
70
                        if $_->isa('Koha::Exceptions::Password::WhitespaceCharacters');
71
                    if ($_->isa('Koha::Exceptions::Password::UsedBefore')) {
71
                    if ( $_->isa('Koha::Exceptions::Password::UsedBefore') ) {
72
                        $error = 'password_used_before';
72
                        $error = 'password_used_before';
73
                        $template->param( 'password_history_count' => C4::Context->preference('PasswordHistoryCount') );
73
                        $template->param(
74
                            'password_history_count' => $patron->category->effective_password_history_count );
74
                    }
75
                    }
75
                };
76
                };
76
            }
77
            }
(-)a/opac/opac-password-recovery.pl (-1 / +2 lines)
Lines 179-186 if ( $op eq 'cud-sendEmail' || $op eq 'cud-resendEmail' ) { Link Here
179
                $error = 'password_has_whitespaces';
179
                $error = 'password_has_whitespaces';
180
            } elsif ( $_->isa('Koha::Exceptions::Password::TooWeak') ) {
180
            } elsif ( $_->isa('Koha::Exceptions::Password::TooWeak') ) {
181
                $error = 'password_too_weak';
181
                $error = 'password_too_weak';
182
            } elsif ($_->isa('Koha::Exceptions::Password::UsedBefore')) {
182
            } elsif ( $_->isa('Koha::Exceptions::Password::UsedBefore') ) {
183
                $error = 'password_used_before';
183
                $error = 'password_used_before';
184
                $template->param( password_history_count => $borrower->category->effective_password_history_count );
184
            }
185
            }
185
        };
186
        };
186
    }
187
    }
(-)a/opac/opac-reset-password.pl (-3 / +3 lines)
Lines 71-79 if ( $op eq 'cud-update' ) { Link Here
71
                            if $_->isa('Koha::Exceptions::Password::TooWeak');
71
                            if $_->isa('Koha::Exceptions::Password::TooWeak');
72
                        $error = 'password_has_whitespaces'
72
                        $error = 'password_has_whitespaces'
73
                            if $_->isa('Koha::Exceptions::Password::WhitespaceCharacters');
73
                            if $_->isa('Koha::Exceptions::Password::WhitespaceCharacters');
74
                        if ($_->isa('Koha::Exceptions::Password::UsedBefore')) {
74
                        if ( $_->isa('Koha::Exceptions::Password::UsedBefore') ) {
75
                            $template->param( password_used_before => 1 );
75
                            $template->param( password_used_before => 1 );
76
                            $template->param( password_history_count => C4::Context->preference('PasswordHistoryCount') );
76
                            $template->param(
77
                                password_history_count => $patron->category->effective_password_history_count );
77
                        }
78
                        }
78
                        $template->param( 'error' => $error );
79
                        $template->param( 'error' => $error );
79
                    };
80
                    };
80
- 

Return to bug 40824