Add form key middleware

This commit is contained in:
Dave Smith-Hayes 2025-04-15 21:30:35 -04:00
parent 281edf9104
commit 8a936fc2f7
2 changed files with 13 additions and 2 deletions

View File

@ -2,14 +2,19 @@
namespace Slovocast\Handler\Channel\Page;
use Odan\Session\SessionInterface;
use Psr\Http\Message\ResponseInterface as Response;
use Slovocast\Handler\Handler;
class CreateChannelPage extends Handler
{
public function __construct(
private SessionInterface $session
) { }
public function handle(): Response
{
// set up the form key
return $this->render('channel/create.twig');
$formKey = $this->session->get("form_key");
return $this->render('channel/create.twig', [ 'form_key' => $formKey ]);
}
}

View File

@ -2,13 +2,19 @@
namespace Slovocast\Handler\User\Page;
use Odan\Session\SessionInterface;
use Psr\Http\Message\ResponseInterface as Response;
use Slovocast\Handler\Handler;
class LoginUserPage extends Handler
{
public function __construct(
private SessionInterface $session
) { }
public function handle(): Response
{
$formKey = $this->session->get("form_key");
return $this->render('user/login.twig');
}
}