diff options
Diffstat (limited to 'application/controllers/api/v1')
-rw-r--r-- | application/controllers/api/v1/user.php | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/application/controllers/api/v1/user.php b/application/controllers/api/v1/user.php index e96a6c6fb..38247d02c 100644 --- a/application/controllers/api/v1/user.php +++ b/application/controllers/api/v1/user.php @@ -24,7 +24,16 @@ class user extends \controllers\api\api_controller { public function create_apikey() { + $username = $this->input->post("username"); + $password = $this->input->post("password"); + if ($username && $password) { + if (!$this->muser->login($username, $password)) { + throw new \exceptions\NotAuthenticatedException("user/login-failed", "Login failed"); + } + } + $this->muser->require_access("full"); + $userid = $this->muser->get_userid(); $comment = $this->input->post("comment"); $comment = $comment === false ? "" : $comment; |