WC_Form_Handler::process_lost_password()public staticWC 1.0

Handle lost password form.

Method of the class: WC_Form_Handler{}

No Hooks.

Return

null. Nothing (null).

Usage

$result = WC_Form_Handler::process_lost_password();

WC_Form_Handler::process_lost_password() code WC 8.6.1

public static function process_lost_password() {
	if ( isset( $_POST['wc_reset_password'], $_POST['user_login'] ) ) {
		$nonce_value = wc_get_var( $_REQUEST['woocommerce-lost-password-nonce'], wc_get_var( $_REQUEST['_wpnonce'], '' ) ); // @codingStandardsIgnoreLine.

		if ( ! wp_verify_nonce( $nonce_value, 'lost_password' ) ) {
			return;
		}

		$success = WC_Shortcode_My_Account::retrieve_password();

		// If successful, redirect to my account with query arg set.
		if ( $success ) {
			wp_safe_redirect( add_query_arg( 'reset-link-sent', 'true', wc_get_account_endpoint_url( 'lost-password' ) ) );
			exit;
		}
	}
}