Authenticate the user using the username and password.

Signature

wp_authenticate_username_password( $user, $username, $password )
user
 (WP_User|WP_Error|null) WP_User or WP_Error object from a previous callback. Default null.
username
 (string) Username for authentication.
password
 (string) Password for authentication.

Return

(WP_User|WP_Error) WP_User on success, WP_Error on failure.

Source

function wp_authenticate_username_password($user, $username, $password) {
	if ( is_a( $user, 'WP_User' ) ) {
		return $user;
	}

	if ( empty($username) || empty($password) ) {
		if ( is_wp_error( $user ) )
			return $user;

		$error = new WP_Error();

		if ( empty($username) )
			$error->add('empty_username', __('<strong>ERROR</strong>: The username field is empty.'));

		if ( empty($password) )
			$error->add('empty_password', __('<strong>ERROR</strong>: The password field is empty.'));

		return $error;
	}

24 more lines...
WP Trac GitHub

Link here