/** * Checks a users login information and logs them in if it checks out. This function is deprecated. * * Use the global $error to get the reason why the login failed. If the username * is blank, no error will be set, so assume blank username on that case. * * Plugins extending this function should also provide the global $error and set * what the error is, so that those checking the global for why there was a * failure can utilize it later. * * @since 1.2.2 * @deprecated Use nxt_signon() * @global string $error Error when false is returned * * @param string $username User's username * @param string $password User's password * @param bool $deprecated Not used * @return bool False on login failure, true on successful check */ function nxt_login($username, $password, $deprecated = '') { _deprecated_function(__FUNCTION__, '2.5', 'nxt_signon()'); global $error; $user = nxt_authenticate($username, $password); if (!is_nxt_error($user)) { return true; } $error = $user->get_error_message(); return false; }
/** * Log user in. * * @since 2.8 * * @param string $username User's username. * @param string $password User's password. * @return mixed nxt_User object if authentication passed, false otherwise */ function login($username, $password) { if (!get_option('enable_xmlrpc')) { $this->error = new IXR_Error(405, sprintf(__('XML-RPC services are disabled on this site. An admin user can enable them at %s'), admin_url('options-writing.php'))); return false; } $user = nxt_authenticate($username, $password); if (is_nxt_error($user)) { $this->error = new IXR_Error(403, __('Bad login/pass combination.')); return false; } nxt_set_current_user($user->ID); return $user; }
/** * Check that the user login name and password is correct. * * @since 0.71 * @todo xmlrpc only. Maybe move to xmlrpc.php. * * @param string $user_login User name. * @param string $user_pass User password. * @return bool False if does not authenticate, true if username and password authenticates. */ function user_pass_ok($user_login, $user_pass) { $user = nxt_authenticate($user_login, $user_pass); if (is_nxt_error($user)) { return false; } return true; }