Skip to content

Commit

Permalink
Only check CSRF on page requests
Browse files Browse the repository at this point in the history
  • Loading branch information
g105b committed Sep 11, 2019
1 parent c0fa6eb commit 1847950
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Lifecycle.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
use Gt\Database\Database;
use Gt\Http\ServerInfo;
use Gt\Http\RequestFactory;
use Gt\WebEngine\Dispatch\PageDispatcher;
use Gt\WebEngine\FileSystem\Path;
use Gt\WebEngine\Route\PageRouter;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
Expand Down Expand Up @@ -104,9 +106,12 @@ public function start():void {
true
)
);
$csrfProtection->processAndVerify(
$input->getAll(Input::DATA_BODY)
);

if($router instanceof PageRouter) {
$csrfProtection->processAndVerify(
$input->getAll(Input::DATA_BODY)
);
}

$dispatcher = $this->createDispatcher(
$config,
Expand Down

0 comments on commit 1847950

Please sign in to comment.