public/wordpress/wp-content/plugins/theme-my-login/includes/compat.php
/**
 * Handles validating the lost password request and retrieving the password reset key.
 *
 * @since 7.0
 *
 * @return True on success, WP_Error on error.
 */
Handles validating the lost password request and retrieving the password reset key.

@return True on success, WP_Error on error.
Handles validating the lost password request and retrieving the password reset key . @return True on success WP_Error on error .
function tml_retrieve_password() {
	$errors = new WP_Error();
	if ( empty( $_POST['user_login'] ) || ! is_string( $_POST['user_login'] ) ) {
		$errors->add( 'empty_username', __( '<strong>ERROR</strong>: Enter a username or email address.' ) );
	} elseif ( strpos( $_POST['user_login'], '@' ) ) {
		$user_data = get_user_by( 'email', trim( wp_unslash( $_POST['user_login'] ) ) );
		if ( empty( $user_data ) ) {
			$errors->add( 'invalid_email', __( '<strong>ERROR</strong>: There is no user registered with that email address.' ) );
		}
	} else {
		$login     = trim( $_POST['user_login'] );
		$user_data = get_user_by( 'login', $login );
	}
	do_action( 'lostpassword_post', $errors );
	if ( $errors->get_error_code() ) {
		return $errors;
	}
	if ( ! $user_data ) {
		$errors->add( 'invalidcombo', __( '<strong>ERROR</strong>: Invalid username or email.' ) );
		return $errors;
	}
	$key = get_password_reset_key( $user_data );
	if ( is_wp_error( $key ) ) {
		return $key;
	}
	do_action( 'retrieved_password_key', $user_data, $key );
	return true;
}
function tml_retrieve_password ( ) { $ errors = new WP_Error ( ) ; if ( empty ( $ _POST [ 'user_login' ] ) || ! is_string ( $ _POST [ 'user_login' ] ) ) { $ errors -> add ( 'empty_username' , __ ( '<strong>ERROR</strong>: Enter a username or email address.' ) ) ; } elseif ( strpos ( $ _POST [ 'user_login' ] , '@' ) ) { $ user_data = get_user_by ( 'email' , trim ( wp_unslash ( $ _POST [ 'user_login' ] ) ) ) ; if ( empty ( $ user_data ) ) { $ errors -> add ( 'invalid_email' , __ ( '<strong>ERROR</strong>: There is no user registered with that email address.' ) ) ; } } else { $ login = trim ( $ _POST [ 'user_login' ] ) ; $ user_data = get_user_by ( 'login' , $ login ) ; } do_action ( 'lostpassword_post' , $ errors ) ; if ( $ errors -> get_error_code ( ) ) { return $ errors ; } if ( ! $ user_data ) { $ errors -> add ( 'invalidcombo' , __ ( '<strong>ERROR</strong>: Invalid username or email.' ) ) ; return $ errors ; } $ key = get_password_reset_key ( $ user_data ) ; if ( is_wp_error ( $ key ) ) { return $ key ; } do_action ( 'retrieved_password_key' , $ user_data , $ key ) ; return true ; }
Handles validating the lost password request and retrieving the password reset key.
Handles validating the lost password request and retrieving the password reset key .
/** This action is documented in wp-login.php */ /**
	 * Fires after a password reset key is retrieved.
	 *
	 * @since unknown
	 *
	 * @param WP_User $user_data The user object.
	 * @param string  $key       The password reset key.
	 */