Commit b758841b authored by Moreau Elise's avatar Moreau Elise
Browse files

add messages and redirection if current user not logged

parent fe4cac7f
...@@ -15,7 +15,7 @@ class AddUserGroupAction extends GroupAction ...@@ -15,7 +15,7 @@ class AddUserGroupAction extends GroupAction
protected function action(): Response protected function action(): Response
{ {
if(!isset($_SESSION['userId'])){ if(!isset($_SESSION['userId'])){
$this->flash->addMessage('login', 'Please log in or sign up.'); $this->flash->addMessage('message', 'Please log in or sign up.');
return $this->response return $this->response
->withHeader('Location', '/login') ->withHeader('Location', '/login')
......
...@@ -17,7 +17,7 @@ class CreateGroupAction extends GroupAction ...@@ -17,7 +17,7 @@ class CreateGroupAction extends GroupAction
$parsedRequestBody = (array)$this->request->getParsedBody(); $parsedRequestBody = (array)$this->request->getParsedBody();
if(!isset($_SESSION['userId'])){ if(!isset($_SESSION['userId'])){
$this->flash->addMessage('login', 'Please log in or sign up.'); $this->flash->addMessage('message', 'Please log in or sign up.');
return $this->response return $this->response
->withHeader('Location', '/login') ->withHeader('Location', '/login')
......
...@@ -15,13 +15,13 @@ class DeleteGroupAction extends GroupAction ...@@ -15,13 +15,13 @@ class DeleteGroupAction extends GroupAction
protected function action(): Response protected function action(): Response
{ {
if(!isset($_SESSION['userId'])){ if(!isset($_SESSION['userId'])){
$this->flash->addMessage('login', 'Please log in or sign up.'); $this->flash->addMessage('message', 'Please log in or sign up.');
return $this->response return $this->response
->withHeader('Location', '/login') ->withHeader('Location', '/login')
->withStatus(302); ->withStatus(302);
} }
$groupId = (int) $this->resolveArg('id'); $groupId = (int) $this->resolveArg('id');
$group = $this->groupRepository->find($groupId); $group = $this->groupRepository->find($groupId);
...@@ -34,7 +34,7 @@ class DeleteGroupAction extends GroupAction ...@@ -34,7 +34,7 @@ class DeleteGroupAction extends GroupAction
->withHeader('Location', '/account') ->withHeader('Location', '/account')
->withStatus(302); ->withStatus(302);
} }
$this->em->remove($group); $this->em->remove($group);
$this->em->flush(); $this->em->flush();
......
...@@ -14,7 +14,7 @@ class ViewModifyGroupForm extends GroupAction ...@@ -14,7 +14,7 @@ class ViewModifyGroupForm extends GroupAction
protected function action(): Response protected function action(): Response
{ {
if(!isset($_SESSION['userId'])){ if(!isset($_SESSION['userId'])){
$this->flash->addMessage('login', 'Please log in or sign up.'); $this->flash->addMessage('message', 'Please log in or sign up.');
return $this->response return $this->response
->withHeader('Location', '/login') ->withHeader('Location', '/login')
......
...@@ -89,7 +89,7 @@ class CreateUserAction extends UserAction ...@@ -89,7 +89,7 @@ class CreateUserAction extends UserAction
$this->logger->info("User has been created."); $this->logger->info("User has been created.");
$this->flash->addMessage('creation', 'Your account has been created. Please log in.'); $this->flash->addMessage('message', 'Your account has been created. Please log in.');
return $this->response return $this->response
->withHeader('Location', '/login') ->withHeader('Location', '/login')
->withStatus(302); ->withStatus(302);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment