WC_Shortcode_My_Account::check_password_reset_key()public staticWC 1.0

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

Method of the class: WC_Shortcode_My_Account{}

No Hooks.

Return

WP_User|true|false. User's database row on success, false for invalid keys

Usage

$result = WC_Shortcode_My_Account::check_password_reset_key( $key, $login );
$key(string) (required)
Hash to validate sending user's password.
$login(string) (required)
The user login.

WC_Shortcode_My_Account::check_password_reset_key() code WC 9.4.2

public static function check_password_reset_key( $key, $login ) {
	// Check for the password reset key.
	// Get user data or an error message in case of invalid or expired key.
	$user = check_password_reset_key( $key, $login );

	if ( is_wp_error( $user ) ) {
		wc_add_notice( __( 'This key is invalid or has already been used. Please reset your password again if needed.', 'woocommerce' ), 'error' );
		return false;
	}

	return $user;
}