Lines 42-47
my $errMultipleAccountsForEmail;
Link Here
|
42 |
my $errAlreadyStartRecovery; |
42 |
my $errAlreadyStartRecovery; |
43 |
my $errTooManyEmailFound; |
43 |
my $errTooManyEmailFound; |
44 |
my $errBadEmail; |
44 |
my $errBadEmail; |
|
|
45 |
my $errResetForbidden; |
45 |
|
46 |
|
46 |
#new password form error |
47 |
#new password form error |
47 |
my $errLinkNotValid; |
48 |
my $errLinkNotValid; |
Lines 73-108
if ( $query->param('sendEmail') || $query->param('resendEmail') ) {
Link Here
|
73 |
$errMultipleAccountsForEmail = 1; |
74 |
$errMultipleAccountsForEmail = 1; |
74 |
} |
75 |
} |
75 |
elsif ( $borrower = $search_results->next() ) { # One matching borrower |
76 |
elsif ( $borrower = $search_results->next() ) { # One matching borrower |
76 |
my @emails = grep { $_ } ( $borrower->email, $borrower->emailpro, $borrower->B_email ); |
|
|
77 |
|
77 |
|
78 |
my $firstNonEmptyEmail; |
78 |
if ( $borrower->category->effective_reset_password ) { |
79 |
$firstNonEmptyEmail = $emails[0] if @emails; |
|
|
80 |
|
79 |
|
81 |
# Is the given email one of the borrower's ? |
80 |
my @emails = grep { $_ } ( $borrower->email, $borrower->emailpro, $borrower->B_email ); |
82 |
if ( $email && !( grep /^$email$/i, @emails ) ) { |
|
|
83 |
$hasError = 1; |
84 |
$errNoBorrowerFound = 1; |
85 |
} |
86 |
|
81 |
|
87 |
# If there is no given email, and there is no email on record |
82 |
my $firstNonEmptyEmail; |
88 |
elsif ( !$email && !$firstNonEmptyEmail ) { |
83 |
$firstNonEmptyEmail = $emails[0] if @emails; |
89 |
$hasError = 1; |
84 |
|
90 |
$errNoBorrowerEmail = 1; |
85 |
# Is the given email one of the borrower's ? |
91 |
} |
86 |
if ( $email && !( grep /^$email$/i, @emails ) ) { |
|
|
87 |
$hasError = 1; |
88 |
$errNoBorrowerFound = 1; |
89 |
} |
90 |
|
91 |
# If there is no given email, and there is no email on record |
92 |
elsif ( !$email && !$firstNonEmptyEmail ) { |
93 |
$hasError = 1; |
94 |
$errNoBorrowerEmail = 1; |
95 |
} |
92 |
|
96 |
|
93 |
# Check if a password reset already issued for this borrower AND we are not asking for a new email |
97 |
# Check if a password reset already issued for this |
94 |
elsif ( not $query->param('resendEmail') ) { |
98 |
# borrower AND we are not asking for a new email |
95 |
if ( ValidateBorrowernumber( $borrower->borrowernumber ) ) { |
99 |
elsif ( not $query->param('resendEmail') ) { |
96 |
$hasError = 1; |
100 |
if ( ValidateBorrowernumber( $borrower->borrowernumber ) ) { |
97 |
$errAlreadyStartRecovery = 1; |
101 |
$hasError = 1; |
|
|
102 |
$errAlreadyStartRecovery = 1; |
103 |
} |
104 |
else { |
105 |
DeleteExpiredPasswordRecovery( $borrower->borrowernumber ); |
106 |
} |
98 |
} |
107 |
} |
99 |
else { |
108 |
# Set the $email, if we don't have one. |
100 |
DeleteExpiredPasswordRecovery( $borrower->borrowernumber ); |
109 |
if ( !$hasError && !$email ) { |
|
|
110 |
$email = $firstNonEmptyEmail; |
101 |
} |
111 |
} |
102 |
} |
112 |
} |
103 |
# Set the $email, if we don't have one. |
113 |
else { |
104 |
if ( !$hasError && !$email ) { |
114 |
$hasError = 1; |
105 |
$email = $firstNonEmptyEmail; |
115 |
$errResetForbidden = 1; |
106 |
} |
116 |
} |
107 |
} |
117 |
} |
108 |
else { # 0 matching borrower |
118 |
else { # 0 matching borrower |
Lines 118-123
if ( $query->param('sendEmail') || $query->param('resendEmail') ) {
Link Here
|
118 |
errBadEmail => $errBadEmail, |
128 |
errBadEmail => $errBadEmail, |
119 |
errNoBorrowerEmail => $errNoBorrowerEmail, |
129 |
errNoBorrowerEmail => $errNoBorrowerEmail, |
120 |
errMultipleAccountsForEmail => $errMultipleAccountsForEmail, |
130 |
errMultipleAccountsForEmail => $errMultipleAccountsForEmail, |
|
|
131 |
errResetForbidden => $errResetForbidden, |
121 |
password_recovery => 1, |
132 |
password_recovery => 1, |
122 |
email => HTML::Entities::encode($email), |
133 |
email => HTML::Entities::encode($email), |
123 |
username => $username |
134 |
username => $username |
124 |
- |
|
|