LLMS_Controller_Account::reset_password()
Handle form submission of the Reset Password form This is the form that actually updates a users password
Description Description
Return Return
(void)
Source Source
File: includes/forms/controllers/class.llms.controller.account.php
public function reset_password() { // invalid nonce or the form wasn't submitted if ( ! llms_verify_nonce( '_reset_password_nonce', 'llms_reset_password', 'POST' ) ) { return; } $valid = LLMS_Person_Handler::validate_fields( $_POST, 'reset_password' ); // validation or registration issues if ( is_wp_error( $valid ) ) { foreach ( $valid->get_error_messages() as $msg ) { llms_add_notice( $msg, 'error' ); } return; } $login = trim( sanitize_text_field( $_POST['llms_reset_login'] ) ); if ( ! llms_verify_password_reset_key( trim( sanitize_text_field( $_POST['llms_reset_key'] ) ), $login ) ) { return llms_add_notice( __( 'Invalid Key', 'lifterlms' ), 'error' ); } $pass = $_POST['password']; $user = get_user_by( 'login', $login ); if ( ! $user ) { return llms_add_notice( __( 'Invalid Key', 'lifterlms' ), 'error' ); } do_action( 'password_reset', $user, $pass ); wp_set_password( $pass, $user->ID ); wp_password_change_notification( $user ); llms_add_notice( sprintf( __( 'Your password has been updated. %1$sClick here to login%2$s', 'lifterlms' ), '<a href="' . esc_url( llms_get_page_url( 'myaccount' ) ) . '">', '</a>' ) ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.8.0 | Introduced. |
User Contributed Notes User Contributed Notes
Permalink: