本文整理汇总了PHP中rest::access_key方法的典型用法代码示例。如果您正苦于以下问题:PHP rest::access_key方法的具体用法?PHP rest::access_key怎么用?PHP rest::access_key使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rest
的用法示例。
在下文中一共展示了rest::access_key方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$username = Input::instance()->post("user");
$password = Input::instance()->post("password");
if (empty($username) || auth::too_many_failures($username)) {
throw new Rest_Exception("Forbidden", 403);
}
$user = identity::lookup_user_by_name($username);
if (empty($user) || !identity::is_correct_password($user, $password)) {
module::event("user_login_failed", $username);
throw new Rest_Exception("Forbidden", 403);
}
auth::login($user);
rest::reply(rest::access_key());
}
示例2: delete_test
public function delete_test()
{
$_SERVER["REQUEST_METHOD"] = "POST";
$_SERVER["HTTP_X_GALLERY_REQUEST_METHOD"] = "delete";
$_POST["key"] = "value";
$this->assert_array_equal_to_json(array("params" => array("key" => "value"), "method" => "delete", "access_key" => rest::access_key(), "url" => "http://./index.php/gallery_unit_test"), test::call_and_capture(array(new Rest_Controller(), "mock")));
}
示例3: reset_access_key
static function reset_access_key()
{
$key = ORM::factory("user_access_key")->where("user_id", "=", identity::active_user()->id)->find();
if ($key->loaded()) {
$key->delete();
}
return rest::access_key();
}