Lines 106-112
sub GetValidLinkInfo {
Link Here
|
106 |
sub SendPasswordRecoveryEmail { |
106 |
sub SendPasswordRecoveryEmail { |
107 |
my $borrower = shift; # Koha::Patron |
107 |
my $borrower = shift; # Koha::Patron |
108 |
my $userEmail = shift; #to_address (the one specified in the request) |
108 |
my $userEmail = shift; #to_address (the one specified in the request) |
109 |
my $update = shift; |
|
|
110 |
my $staff = shift // 0; |
109 |
my $staff = shift // 0; |
111 |
|
110 |
|
112 |
my $schema = Koha::Database->new->schema; |
111 |
my $schema = Koha::Database->new->schema; |
Lines 121-142
sub SendPasswordRecoveryEmail {
Link Here
|
121 |
my $days = $staff ? STAFF : PATRON; |
120 |
my $days = $staff ? STAFF : PATRON; |
122 |
my $expirydate = |
121 |
my $expirydate = |
123 |
dt_from_string()->add( days => $days ); |
122 |
dt_from_string()->add( days => $days ); |
124 |
if ($update) { |
123 |
my $rs = $schema->resultset('BorrowerPasswordRecovery')->update_or_create( |
125 |
my $rs = |
|
|
126 |
$schema->resultset('BorrowerPasswordRecovery') |
127 |
->search( { borrowernumber => $borrower->borrowernumber, } ); |
128 |
$rs->update( |
129 |
{ uuid => $uuid_str, valid_until => $expirydate->datetime() } ); |
130 |
} |
131 |
else { |
132 |
my $rs = $schema->resultset('BorrowerPasswordRecovery')->create( |
133 |
{ |
124 |
{ |
134 |
borrowernumber => $borrower->borrowernumber, |
125 |
borrowernumber => $borrower->borrowernumber, |
135 |
uuid => $uuid_str, |
126 |
uuid => $uuid_str, |
136 |
valid_until => $expirydate->datetime() |
127 |
valid_until => $expirydate->datetime() |
137 |
} |
128 |
}, |
|
|
129 |
{ key => 'primary' } |
138 |
); |
130 |
); |
139 |
} |
|
|
140 |
|
131 |
|
141 |
# create link |
132 |
# create link |
142 |
my $opacbase = C4::Context->preference('OPACBaseURL') || ''; |
133 |
my $opacbase = C4::Context->preference('OPACBaseURL') || ''; |