. * * @category API * @package StatusNet * @author Evan Prodromou * @author Robin Millette * @author Zach Copley * @copyright 2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ if (!defined('STATUSNET')) { exit(1); } /** * Check a user's credentials. Returns an HTTP 200 OK response code and a * representation of the requesting user if authentication was successful; * returns a 401 status code and an error message if not. * * @category API * @package StatusNet * @author Evan Prodromou * @author Robin Millette * @author Zach Copley * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ class ApiQvitterCheckLoginAction extends ApiAction { /** * Handle the request * * Check whether the credentials are valid and output the result * * @param array $args $_REQUEST data (unused) * * @return void */ function handle($args) { parent::handle($args); if ($_SERVER['REQUEST_METHOD'] != 'POST') { $this->clientError( // TRANS: Client error. POST is a HTTP command. It should not be translated. _('This method requires a POST.'), 400, $this->format ); return; } $user = common_check_user($this->arg('username'), $this->arg('password')); if($user) { $user = true; } $this->initDocument('json'); $this->showJsonObjects($user); $this->endDocument('json'); } /** * Is this action read only? * * @param array $args other arguments * * @return boolean true */ function isReadOnly($args) { return true; } }