WC_Shortcode_My_Account::reset_password
Handles resetting the user's password.
Method of the class: WC_Shortcode_My_Account{}
Hooks from the method
Returns
null. Nothing (null).
Usage
$result = WC_Shortcode_My_Account::reset_password( $user, $new_pass );
- $user(object) (required)
- The user.
- $new_pass(string) (required)
- New password for the user in plaintext.
Changelog
| Since 9.4.0 | Introduced. |
| Since 9.4.0 | This will log the user in after resetting the password/session. |
WC_Shortcode_My_Account::reset_password() WC Shortcode My Account::reset password code WC 10.8.1
public static function reset_password( $user, $new_pass ) {
// phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment
do_action( 'password_reset', $user, $new_pass );
wp_set_password( $new_pass, $user->ID );
update_user_meta( $user->ID, 'default_password_nag', false );
self::set_reset_password_cookie();
wc_set_customer_auth_cookie( $user->ID );
// phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment
if ( ! apply_filters( 'woocommerce_disable_password_change_notification', false ) ) {
wp_password_change_notification( $user );
}
}