summaryrefslogtreecommitdiff
path: root/modules/rest/helpers/rest.php
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-08-08 21:49:30 -0700
committerBharat Mediratta <bharat@menalto.com>2010-08-08 21:49:30 -0700
commit0014745d4ad0c5e95e4ebced95062a6272359bf5 (patch)
treeee6183982710b3af96beb5f7413c435f0ddf277c /modules/rest/helpers/rest.php
parent639d31a2c1a54f31ad32208b8602a8922d336fa0 (diff)
Add a button to the user profile page to let you reset your REST API
key. This is useful if you think it's been compromised in some way. Fixes ticket #1226.
Diffstat (limited to 'modules/rest/helpers/rest.php')
-rw-r--r--modules/rest/helpers/rest.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/rest/helpers/rest.php b/modules/rest/helpers/rest.php
index 73d09c64..333daf95 100644
--- a/modules/rest/helpers/rest.php
+++ b/modules/rest/helpers/rest.php
@@ -87,6 +87,16 @@ class rest_Core {
identity::set_active_user($user);
}
+ 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();
+ }
+
static function access_key() {
$key = ORM::factory("user_access_key")
->where("user_id", "=", identity::active_user()->id)