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 |
- |
|
|