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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-password-recovery.tt (-1 / +4 lines)
Lines 54-59 Link Here
54
                        <br/>Please try again later.
54
                        <br/>Please try again later.
55
                    [% ELSIF (errNoBorrowerFound) %]
55
                    [% ELSIF (errNoBorrowerFound) %]
56
                        No account was found with the provided information.
56
                        No account was found with the provided information.
57
                    [% ELSIF (errMultipleAccountsForEmail) %]
58
                        Account identification with this email address only is ambiguous.
59
                        <br />Please use the field 'Login' as well.
57
                    [% ELSIF (errAlreadyStartRecovery) %]
60
                    [% ELSIF (errAlreadyStartRecovery) %]
58
                        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 ("<strong>[% username %]</strong>")
59
                        <br/>You should have received an email with a link to reset your password.
62
                        <br/>You should have received an email with a link to reset your password.
Lines 78-84 Link Here
78
                    <form action="/cgi-bin/koha/opac-password-recovery.pl" method="post">
81
                    <form action="/cgi-bin/koha/opac-password-recovery.pl" method="post">
79
                        <input type="hidden" name="koha_login_context" value="opac" />
82
                        <input type="hidden" name="koha_login_context" value="opac" />
80
                        <fieldset>
83
                        <fieldset>
81
                            <p>To reset your password, enter your login and email address.
84
                            <p>To reset your password, enter your login and your email address.
82
                            <label for="username">Login:</label>
85
                            <label for="username">Login:</label>
83
                            <input type="text" id="username" size="40" name="username" value="[% username %]" />
86
                            <input type="text" id="username" size="40" name="username" value="[% username %]" />
84
                            <label for="email">Email:</label>
87
                            <label for="email">Email:</label>
(-)a/opac/opac-password-recovery.pl (-2 / +15 lines)
Lines 36-45 my $borrower_number; Link Here
36
36
37
#errors
37
#errors
38
my $hasError;
38
my $hasError;
39
my $resultCount;
39
40
40
#email form error
41
#email form error
41
my $errNoBorrowerFound;
42
my $errNoBorrowerFound;
42
my $errNoBorrowerEmail;
43
my $errNoBorrowerEmail;
44
my $errMultipleAccountsForEmail;
43
my $errAlreadyStartRecovery;
45
my $errAlreadyStartRecovery;
44
my $errTooManyEmailFound;
46
my $errTooManyEmailFound;
45
my $errBadEmail;
47
my $errBadEmail;
Lines 59-72 if ( $query->param('sendEmail') || $query->param('resendEmail') ) { Link Here
59
    # Find the borrower by his userid or email
61
    # Find the borrower by his userid or email
60
    if ($username) {
62
    if ($username) {
61
        $search_results = [ Koha::Patrons->search( { userid => $username } ) ];
63
        $search_results = [ Koha::Patrons->search( { userid => $username } ) ];
64
        $resultCount = Koha::Patrons->search( { userid => $username } ) -> count
62
    }
65
    }
63
    elsif ($email) {
66
    elsif ($email) {
64
        $search_results = [ Koha::Patrons->search( { -or => { email => $email, emailpro => $email, B_email  => $email } } ) ];
67
        $search_results = [ Koha::Patrons->search( { -or => { email => $email, emailpro => $email, B_email  => $email } } ) ];
68
        $resultCount = Koha::Patrons->search( { -or => { email => $email, emailpro => $email, B_email  => $email } } ) -> count;
65
    }
69
    }
66
    if ( not $search_results || scalar @$search_results > 1 ) {
70
71
    if ( not $search_results || $resultCount < 1) {
72
        $hasError           = 1;
73
        $errNoBorrowerFound = 1;
74
    }
75
    elsif ( $username && scalar $resultCount > 1) { # Multiple accounts for username
67
        $hasError           = 1;
76
        $hasError           = 1;
68
        $errNoBorrowerFound = 1;
77
        $errNoBorrowerFound = 1;
69
    }
78
    }
79
    elsif ( $email && scalar $resultCount > 1) { # Muliple accounts for E-Mail
80
        $hasError           = 1;
81
        $errMultipleAccountsForEmail = 1;
82
    }
70
    elsif ( $borrower = shift @$search_results ) {    # One matching borrower
83
    elsif ( $borrower = shift @$search_results ) {    # One matching borrower
71
        $username ||= $borrower->userid;
84
        $username ||= $borrower->userid;
72
        my @emails = ( $borrower->email, $borrower->emailpro, $borrower->B_email );
85
        my @emails = ( $borrower->email, $borrower->emailpro, $borrower->B_email );
Lines 112-117 if ( $query->param('sendEmail') || $query->param('resendEmail') ) { Link Here
112
            errAlreadyStartRecovery => $errAlreadyStartRecovery,
125
            errAlreadyStartRecovery => $errAlreadyStartRecovery,
113
            errBadEmail             => $errBadEmail,
126
            errBadEmail             => $errBadEmail,
114
            errNoBorrowerEmail      => $errNoBorrowerEmail,
127
            errNoBorrowerEmail      => $errNoBorrowerEmail,
128
            errMultipleAccountsForEmail => $errMultipleAccountsForEmail,
115
            password_recovery       => 1,
129
            password_recovery       => 1,
116
            email                   => HTML::Entities::encode($email),
130
            email                   => HTML::Entities::encode($email),
117
            username                => $username
131
            username                => $username
118
- 

Return to bug 16711