adapt code to soko-web 0.4

This commit is contained in:
bence committed 2023-04-16 21:38:25 +02:00
1 parent 317a4de5c0
commit 82562117b2
4 files changed
+35 -79

No files matched your search

+19
View File
@@ -1,5 +1,7 @@
<?php
use SokoWeb\Response\HttpResponse;
require 'main.php';
if (!empty($_ENV['DEV'])) {
@@ -118,3 +120,20 @@ Container::$request = new SokoWeb\Request\Request(
if (!Container::$request->session()->has('anti_csrf_token')) {
Container::$request->session()->set('anti_csrf_token', bin2hex(random_bytes(16)));
}
$appConfig = [
'antiCsrfTokenName' => 'anti_csrf_token',
'antiCsrfTokenErrorResponse' => ['error' => 'no_valid_anti_csrf_token'],
'antiCsrfTokenExceptions' => [],
'loginRouteId' => 'login',
'error404View' => 'error/404'
];
$httpReponse = new HttpResponse(
Container::$request,
Container::$routeCollection,
$appConfig,
$_SERVER['REQUEST_METHOD'],
$_SERVER['REQUEST_URI']
);
$httpReponse->render();