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

(-)a/C4/Members.pm (-3 / +8 lines)
Lines 2268-2273 sub SendPasswordRecoveryEmail { Link Here
2268
    my $borrowernumber = shift;
2268
    my $borrowernumber = shift;
2269
    my $email = shift;
2269
    my $email = shift;
2270
    my $query = shift;
2270
    my $query = shift;
2271
    my $update = shift;
2271
    my $dbh = C4::Context->dbh;
2272
    my $dbh = C4::Context->dbh;
2272
    my $username = GetMemberDetails($borrowernumber)->{userid};
2273
    my $username = GetMemberDetails($borrowernumber)->{userid};
2273
2274
Lines 2278-2286 sub SendPasswordRecoveryEmail { Link Here
2278
2279
2279
    #insert into database
2280
    #insert into database
2280
    my $expirydate = DateTime->now(time_zone => C4::Context->tz())->add( days => 2 );
2281
    my $expirydate = DateTime->now(time_zone => C4::Context->tz())->add( days => 2 );
2281
    my $sth = $dbh->prepare( 'INSERT INTO borrower_password_recovery VALUES (?, ?, ?)');
2282
    if($update){
2282
    $sth->execute($borrowernumber, $uuid_str, $expirydate->ymd());
2283
	    my $sth = $dbh->prepare( 'UPDATE borrower_password_recovery set uuid=?, valid_until=? where borrowernumber=?');
2283
2284
	    $sth->execute($uuid_str, $expirydate->datetime(), $borrowernumber);
2285
    } else {
2286
	    my $sth = $dbh->prepare( 'INSERT INTO borrower_password_recovery VALUES (?, ?, ?)');
2287
	    $sth->execute($borrowernumber, $uuid_str, $expirydate->ymd());
2288
    }
2284
    my $userEmail = ( $email ) ? $email : GetFirstValidEmailAddress($borrowernumber);
2289
    my $userEmail = ( $email ) ? $email : GetFirstValidEmailAddress($borrowernumber);
2285
    #define to/from emails
2290
    #define to/from emails
2286
    my $kohaEmail = C4::Context->preference( 'KohaAdminEmailAddress' );
2291
    my $kohaEmail = C4::Context->preference( 'KohaAdminEmailAddress' );
(-)a/opac/opac-password-recovery.pl (-2 / +1 lines)
Lines 87-93 if ( $query->param('sendEmail') || $query->param('resendEmail') ) { Link Here
87
            email                   => HTML::Entities::encode($email),
87
            email                   => HTML::Entities::encode($email),
88
        );
88
        );
89
    }
89
    }
90
    elsif ( SendPasswordRecoveryEmail( $borrower_number, $email, $query ) ) {#generate uuid and send recovery email
90
    elsif ( SendPasswordRecoveryEmail( $borrower_number, $email, $query, $query->param('resendEmail') ) ) {#generate uuid and send recovery email
91
        $template->param(
91
        $template->param(
92
            mail_sent => 1,
92
            mail_sent => 1,
93
            email     => $email
93
            email     => $email
94
- 

Return to bug 8753