/var/www/html_us/wp-content/plugins/checkout-for-woocommerce/includes/Action/LostPasswordAction.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php

namespace Objectiv\Plugins\Checkout\Action;

/**
 * Class LogInAction
 *
 * @link checkoutwc.com
 * @since 1.0.0
 * @package Objectiv\Plugins\Checkout\Action
 * @author Brandon Tassone <[email protected]>
 */
class LostPasswordAction extends CFWAction {

    
/**
     * LogInAction constructor.
     *
     * @since 1.0.0
     * @access public
     */
    
public function __construct() {
        
parent::__construct'cfw_lost_password'false );
    }

    
/**
     * Logs in the user based on the information passed. If information is incorrect it returns an error message
     *
     * @since 1.0.0
     * @access public
     */
    
public function action() {
        
parse_str$_POST['fields'], $post_data );

        
$nonce_value wc_get_var$post_data['woocommerce-lost-password-nonce'], wc_get_var$post_data['_wpnonce'], '' ) ); // @codingStandardsIgnoreLine.
        
$error       = array(
            
'result'  => false,
            
'message' => 'An error occurred. Please contact site administrator.',
        );

        if ( ! 
wp_verify_nonce$nonce_value'lost_password' ) ) {
            
$this->out$error );
        }

        
$_POST['user_login'] = $post_data['user_login'];
        
$success             \WC_Shortcode_My_Account::retrieve_password();

        if ( ! 
$success ) {
            
$all_notices WC()->session->get'wc_notices', array() );

            
$notice_type 'error';
            
$notices     = array();

            if ( 
wc_notice_count$notice_type ) > && isset( $all_notices$notice_type ] ) ) {
                
// In WooCommerce 3.9+, messages can be an array with two properties:
                // - notice
                // - data
                
foreach ( $all_notices$notice_type ] as $index => $notice ) {
                    
$notices[] = $notice['notice'] ?? $notice;
                    unset( 
$all_notices$notice_type ][ $index ] );
                }
            }

            
WC()->session->set'wc_notices'$all_notices );

            
$this->out(
                array(
                    
'result'  => false,
                    
'message' => join' '$notices ),
                )
            );
        }

        
$this->out(
            array(
                
'result'  => true,
                
'message' => esc_htmlapply_filters'woocommerce_lost_password_confirmation_message'cfw_esc_html__'A password reset email has been sent to the email address on file for your account, but may take several minutes to show up in your inbox. Please wait at least 10 minutes before attempting another reset.''woocommerce' ) ) ),
            )
        );
    }
}