aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/api
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+github@gmail.com>2021-08-26 10:52:42 +0200
committerJan-Hendrik Willms <tleilax+github@gmail.com>2021-08-26 10:52:42 +0200
commit5d0a8269e33be98f270253013eda7b05d477edd5 (patch)
tree0ccccf95a9b218e4254d80f3947111dc37f980af /app/controllers/api
parentcf997f4c7d1fc0474fea242c6d4e9206a0bc3521 (diff)
fail if no consumer was detected, fixes #46
Diffstat (limited to 'app/controllers/api')
-rw-r--r--app/controllers/api/oauth.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/controllers/api/oauth.php b/app/controllers/api/oauth.php
index dce5084..22caab1 100644
--- a/app/controllers/api/oauth.php
+++ b/app/controllers/api/oauth.php
@@ -66,6 +66,12 @@ class Api_OauthController extends StudipController
try {
$consumer = RESTAPI\Consumer\Base::detectConsumer('oauth', 'request');
+ if (!$consumer) {
+ $this->response->set_status(400, 'No consumer detected');
+ $this->render_nothing();
+ return;
+ }
+
if (Request::submitted('allow')) {
$result = $consumer->grantAccess($GLOBALS['user']->id);