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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-password-recovery.tt (-1 / +6 lines)
Lines 58-64 Link Here
58
                        Account identification with this email address only is ambiguous.
58
                        Account identification with this email address only is ambiguous.
59
                        <br />Please use the field 'Login' as well.
59
                        <br />Please use the field 'Login' as well.
60
                    [% ELSIF (errAlreadyStartRecovery) %]
60
                    [% ELSIF (errAlreadyStartRecovery) %]
61
                        The process of password recovery has already been started for this account ("<strong>[% username %]</strong>")
61
                        The process of password recovery has already been started for this account
62
                        [% IF username %]
63
                            ("<strong>[% username %]</strong>")
64
                        [% ELSIF email %]
65
                            ("<strong>[% email %]</strong>")
66
                        [% END %]
62
                        <br/>You should have received an email with a link to reset your password.
67
                        <br/>You should have received an email with a link to reset your password.
63
                        <br/>If you did not receive this email, you can request a new one: <a href="/cgi-bin/koha/opac-password-recovery.pl?resendEmail=true&email=[% email %]&username=[% username %]">Get new password recovery link</a>
68
                        <br/>If you did not receive this email, you can request a new one: <a href="/cgi-bin/koha/opac-password-recovery.pl?resendEmail=true&email=[% email %]&username=[% username %]">Get new password recovery link</a>
64
                    [% ELSIF (errPassNotMatch) %]
69
                    [% ELSIF (errPassNotMatch) %]
(-)a/opac/opac-password-recovery.pl (-7 / +10 lines)
Lines 31-37 my $repeatPassword = $query->param('repeatPassword'); Link Here
31
my $minPassLength  = C4::Context->preference('minPasswordLength');
31
my $minPassLength  = C4::Context->preference('minPasswordLength');
32
my $id             = $query->param('id');
32
my $id             = $query->param('id');
33
my $uniqueKey      = $query->param('uniqueKey');
33
my $uniqueKey      = $query->param('uniqueKey');
34
my $username       = $query->param('username');
34
my $username       = $query->param('username') // q{};
35
my $borrower_number;
35
my $borrower_number;
36
36
37
#errors
37
#errors
Lines 53-59 my $errPassTooShort; Link Here
53
if ( $query->param('sendEmail') || $query->param('resendEmail') ) {
53
if ( $query->param('sendEmail') || $query->param('resendEmail') ) {
54
54
55
    #try with the main email
55
    #try with the main email
56
    $email ||= '';    # avoid undef
57
    my $borrower;
56
    my $borrower;
58
    my $search_results;
57
    my $search_results;
59
58
Lines 65-71 if ( $query->param('sendEmail') || $query->param('resendEmail') ) { Link Here
65
        $search_results = Koha::Patrons->search( { -or => { email => $email, emailpro => $email, B_email  => $email } } );
64
        $search_results = Koha::Patrons->search( { -or => { email => $email, emailpro => $email, B_email  => $email } } );
66
    }
65
    }
67
66
68
    if ( not $search_results || $search_results->count < 1) {
67
    if ( ! defined $search_results || $search_results->count < 1) {
69
        $hasError           = 1;
68
        $hasError           = 1;
70
        $errNoBorrowerFound = 1;
69
        $errNoBorrowerFound = 1;
71
    }
70
    }
Lines 78-84 if ( $query->param('sendEmail') || $query->param('resendEmail') ) { Link Here
78
        $errMultipleAccountsForEmail = 1;
77
        $errMultipleAccountsForEmail = 1;
79
    }
78
    }
80
    elsif ( $borrower = $search_results->next() ) {    # One matching borrower
79
    elsif ( $borrower = $search_results->next() ) {    # One matching borrower
81
        $username ||= $borrower->userid;
82
        my @emails = ( $borrower->email, $borrower->emailpro, $borrower->B_email );
80
        my @emails = ( $borrower->email, $borrower->emailpro, $borrower->B_email );
83
81
84
        my $firstNonEmptyEmail = '';
82
        my $firstNonEmptyEmail = '';
Lines 93-104 if ( $query->param('sendEmail') || $query->param('resendEmail') ) { Link Here
93
            $errNoBorrowerFound = 1;
91
            $errNoBorrowerFound = 1;
94
        }
92
        }
95
93
96
# If we dont have an email yet. Get one of the borrower's email or raise an error.
94
# If we dont have an email and one was not provided.
97
        elsif ( !$email && !( $email = $firstNonEmptyEmail ) ) {
95
        elsif ( !$email && !$firstNonEmptyEmail ) {
98
            $hasError           = 1;
96
            $hasError           = 1;
99
            $errNoBorrowerEmail = 1;
97
            $errNoBorrowerEmail = 1;
100
        }
98
        }
101
99
100
# If we dont have an email and one was provided.
101
        elsif ( !$email && $firstNonEmptyEmail ) {
102
            $hasError           = 1;
103
            $errAlreadyStartRecovery = 1;
104
        }
105
102
# Check if a password reset already issued for this borrower AND we are not asking for a new email
106
# Check if a password reset already issued for this borrower AND we are not asking for a new email
103
        elsif ( not $query->param('resendEmail') ) {
107
        elsif ( not $query->param('resendEmail') ) {
104
            if ( ValidateBorrowernumber( $borrower->borrowernumber ) ) {
108
            if ( ValidateBorrowernumber( $borrower->borrowernumber ) ) {
105
- 

Return to bug 18956