feature: csrf protection

This commit is contained in:
slawkens
2023-09-16 09:23:51 +02:00
parent 046c0b5cf4
commit 0e33fd103c
72 changed files with 332 additions and 39 deletions

View File

@@ -9,6 +9,7 @@
*/
defined('MYAAC') or die('Direct access not allowed!');
use MyAAC\CsrfToken;
use Twig\Environment as Twig_Environment;
use Twig\Extension\DebugExtension as Twig_DebugExtension;
use Twig\Loader\FilesystemLoader as Twig_FilesystemLoader;
@@ -118,6 +119,16 @@ $function = new TwigFunction('getCustomPage', function ($name) {
});
$twig->addFunction($function);
$function = new TwigFunction('csrf', function () {
csrf();
});
$twig->addFunction($function);
$function = new TwigFunction('csrfToken', function () {
return csrfToken();
});
$twig->addFunction($function);
$filter = new TwigFilter('urlencode', function ($s) {
return urlencode($s);
});