Dev Resources

  • Home
  • Reference
  • BuddyX Theme
  • Functions
  • Hooks
  • Classes
Filter by type:
Search
Browse: Home / Reference / Classes / WC_Shortcode_My_Account / WC_Shortcode_My_Account::lost_password()

WC_Shortcode_My_Account::lost_password()

Lost password page handling.

Contents

  • Description
    • Source
  • Related
    • Uses
    • Used By
  • User Contributed Notes

Description #Description


Source #Source

File: includes/shortcodes/class-wc-shortcode-my-account.php

	public static function lost_password() {
		/**
		 * After sending the reset link, don't show the form again.
		 */
		if ( ! empty( $_GET['reset-link-sent'] ) ) { // WPCS: input var ok, CSRF ok.
			return wc_get_template( 'myaccount/lost-password-confirmation.php' );

			/**
			 * Process reset key / login from email confirmation link
			 */
		} elseif ( ! empty( $_GET['show-reset-form'] ) ) { // WPCS: input var ok, CSRF ok.
			if ( isset( $_COOKIE[ 'wp-resetpass-' . COOKIEHASH ] ) && 0 < strpos( $_COOKIE[ 'wp-resetpass-' . COOKIEHASH ], ':' ) ) {  // @codingStandardsIgnoreLine
				list( $rp_id, $rp_key ) = array_map( 'wc_clean', explode( ':', wp_unslash( $_COOKIE[ 'wp-resetpass-' . COOKIEHASH ] ), 2 ) ); // @codingStandardsIgnoreLine
				$userdata               = get_userdata( absint( $rp_id ) );
				$rp_login               = $userdata ? $userdata->user_login : '';
				$user                   = self::check_password_reset_key( $rp_key, $rp_login );

				// Reset key / login is correct, display reset password form with hidden key / login values.
				if ( is_object( $user ) ) {
					return wc_get_template(
						'myaccount/form-reset-password.php',
						array(
							'key'   => $rp_key,
							'login' => $rp_login,
						)
					);
				}
			}
		}

		// Show lost password form by default.
		wc_get_template(
			'myaccount/form-lost-password.php',
			array(
				'form' => 'lost_password',
			)
		);
	}

Expand full source code Collapse full source code


Top ↑

Related #Related

Top ↑

Uses #Uses

Uses
Uses Description
includes/wc-core-functions.php: wc_get_template()

Get other templates (e.g. product attributes) passing attributes and including the file.

includes/shortcodes/class-wc-shortcode-my-account.php: WC_Shortcode_My_Account::check_password_reset_key()

Retrieves a user row based on password reset key and login.

Top ↑

Used By #Used By

Used By
Used By Description
includes/shortcodes/class-wc-shortcode-my-account.php: WC_Shortcode_My_Account::output()

Output the shortcode.


Top ↑

User Contributed Notes #User Contributed Notes

You must log in before being able to contribute a note or feedback.

Proudly powered by WordPress