summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2013-09-08 20:55:26 +0200
committerFlorian Pritz <bluewind@xinu.at>2013-09-08 20:56:05 +0200
commitd3f3f69e6aa20254eb68118f83663579558ca2ab (patch)
treeefe8e6e57fa296f46d44dbee5cace5ce45c4c43c
parente4452f0f314797ed0a36deb1eeafa7a830987519 (diff)
user/create_apikey: Add JSON support
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rw-r--r--application/controllers/user.php5
1 files changed, 5 insertions, 0 deletions
diff --git a/application/controllers/user.php b/application/controllers/user.php
index 38b18c9a0..823166ea5 100644
--- a/application/controllers/user.php
+++ b/application/controllers/user.php
@@ -9,6 +9,7 @@
class User extends MY_Controller {
protected $json_enabled_functions = array(
+ "create_apikey",
"apikeys",
);
@@ -94,6 +95,10 @@ class User extends MY_Controller {
VALUES (?, ?, ?)
", array($key, $userid, $comment));
+ if (static_storage("response_type") == "json") {
+ return send_json_reply(array("new_key" => $key));
+ }
+
if (is_cli_client()) {
echo "$key\n";
} else {