diff --git a/app/src/Controller/Channel/CreateChannelAction.php b/app/src/Controller/Channel/CreateChannelAction.php new file mode 100644 index 0000000..21888f2 --- /dev/null +++ b/app/src/Controller/Channel/CreateChannelAction.php @@ -0,0 +1,28 @@ +session->get('user'); + $formData = $this->request->getParsedBody(); + + if ($userData['id'] !== $formData['user_id']) { + $this->session->getFlash()->add("error", "Unable to create channel."); + $this->logger->error("Session User ID and Form User ID do no match."); + return $this->render('channel/create.twig')->withStatus(400); + } + } +} diff --git a/app/src/Controller/Channel/CreateChannelPage.php b/app/src/Controller/Channel/CreateChannelPage.php index 037124e..393f8f2 100644 --- a/app/src/Controller/Channel/CreateChannelPage.php +++ b/app/src/Controller/Channel/CreateChannelPage.php @@ -2,6 +2,7 @@ namespace Slovocast\Controller\Channel; +use Odan\Session\SessionInterface; use Psr\Http\Message\ResponseInterface as Response; use Slovocast\Controller\Controller; diff --git a/app/templates/channel/create.twig b/app/templates/channel/create.twig index 12f9dee..18f38e3 100644 --- a/app/templates/channel/create.twig +++ b/app/templates/channel/create.twig @@ -15,6 +15,24 @@ +
+
+ +
+
+ +
+
+