Commit d8a41efe authored by Ad Schellevis's avatar Ad Schellevis Committed by Franco Fichtner

(mvc) fix http status codes, closes https://github.com/opnsense/core/issues/1358

(cherry picked from commit e574dcc6)
parent 74af0eaa
......@@ -171,6 +171,7 @@ class ApiControllerBase extends ControllerRoot
// handle UI ajax requests
// use session data and ACL to validate request.
if (!$this->doAuth()) {
$this->response->setStatusCode(401, "Unauthorized");
return false;
}
......@@ -185,6 +186,7 @@ class ApiControllerBase extends ControllerRoot
) {
// missing csrf, exit.
$this->getLogger()->error("no matching csrf found for request");
$this->response->setStatusCode(403, "Forbidden");
return false;
}
}
......
......@@ -179,6 +179,7 @@ class ControllerBase extends ControllerRoot
// check for valid csrf on post requests
if ($this->request->isPost() && !$this->security->checkToken(null, null, false)) {
// post without csrf, exit.
$this->response->setStatusCode(403, "Forbidden");
return false;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment