From 5119d58e7ff06e1ba922d73bf47aefd242dc888f Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 20 Jan 2010 00:07:03 -0800 Subject: Move access key creation into a helper function. --- modules/rest/controllers/rest.php | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'modules/rest/controllers') diff --git a/modules/rest/controllers/rest.php b/modules/rest/controllers/rest.php index a6b618e8..9f0bc5b3 100644 --- a/modules/rest/controllers/rest.php +++ b/modules/rest/controllers/rest.php @@ -27,15 +27,7 @@ class Rest_Controller extends Controller { throw new Rest_Exception("Forbidden", 403); } - $key = ORM::factory("user_access_token") - ->where("user_id", "=", $user->id) - ->find(); - if (!$key->loaded()) { - $key->user_id = $user->id; - $key->access_key = md5($user->name . rand()); - $key->save(); - } - + $key = rest::get_access_token($user->id); rest::reply($key->access_key); } -- cgit v1.2.3