mirror of
https://github.com/opnsense/core.git
synced 2026-05-28 04:34:51 -04:00
MVC: fix API regression caused by d7d016f400, closes https://github.com/opnsense/core/issues/7645
This commit is contained in:
parent
ba49c8b65f
commit
9024abe3f8
1 changed files with 9 additions and 0 deletions
|
|
@ -274,6 +274,15 @@ class ApiControllerBase extends ControllerRoot
|
|||
} else {
|
||||
// link username on successful login
|
||||
$this->logged_in_user = $authResult['username'];
|
||||
// if body is send as json data, parse to $_POST first
|
||||
$dispatchError = $this->parseJsonBodyData();
|
||||
if ($dispatchError != null) {
|
||||
$this->response->setStatusCode(400, "Bad Request");
|
||||
$this->response->setContentType('application/json', 'UTF-8');
|
||||
$this->response->setJsonContent(['status' => 400, 'message' => $dispatchError]);
|
||||
$this->response->send();
|
||||
return false;
|
||||
}
|
||||
|
||||
// pass revision context to config object
|
||||
Config::getInstance()->setRevisionContext([
|
||||
|
|
|
|||
Loading…
Reference in a new issue