summaryrefslogtreecommitdiff
path: root/modules/rest/controllers
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-01-20 00:07:03 -0800
committerBharat Mediratta <bharat@menalto.com>2010-01-20 00:07:03 -0800
commit5119d58e7ff06e1ba922d73bf47aefd242dc888f (patch)
tree2b201427f30083edcd3df88014a48feb16caf5dd /modules/rest/controllers
parent66fbbab9071e73df01b316bb29842fdc3b29c39c (diff)
Move access key creation into a helper function.
Diffstat (limited to 'modules/rest/controllers')
-rw-r--r--modules/rest/controllers/rest.php10
1 files changed, 1 insertions, 9 deletions
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);
}