Maintenance Gitlab - Jeudi 09 Décembre 2021 à partir de 10h - Mises à jour de sécurité

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

rename flash messages

parent 972454e7
...@@ -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('message', 'Please log in or sign up.'); $this->flash->addMessage('flashMessages', '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('message', 'Please log in or sign up.'); $this->flash->addMessage('flashMessages', 'Please log in or sign up.');
return $this->response return $this->response
->withHeader('Location', '/login') ->withHeader('Location', '/login')
...@@ -36,7 +36,7 @@ class CreateGroupAction extends GroupAction ...@@ -36,7 +36,7 @@ class CreateGroupAction extends GroupAction
"name" => $groupname, "name" => $groupname,
"description" => $description, "description" => $description,
"private" => $private, "private" => $private,
"message" => "Groupname already exist", "flashMessages" => [["Groupname already exist"]],
"formstatus" => "error" "formstatus" => "error"
) )
); );
......
...@@ -15,7 +15,7 @@ class DeleteGroupAction extends GroupAction ...@@ -15,7 +15,7 @@ class DeleteGroupAction extends GroupAction
protected function action(): Response protected function action(): Response
{ {
if(!isset($_SESSION['userId'])){ if(!isset($_SESSION['userId'])){
$this->flash->addMessage('message', 'Please log in or sign up.'); $this->flash->addMessage('flashMessages', 'Please log in or sign up.');
return $this->response return $this->response
->withHeader('Location', '/login') ->withHeader('Location', '/login')
......
...@@ -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('message', 'Please log in or sign up.'); $this->flash->addMessage('flashMessages', 'Please log in or sign up.');
return $this->response return $this->response
->withHeader('Location', '/login') ->withHeader('Location', '/login')
......
...@@ -56,7 +56,7 @@ class CreateUserAction extends UserAction ...@@ -56,7 +56,7 @@ class CreateUserAction extends UserAction
"contaminated" => $contaminated, "contaminated" => $contaminated,
"password" => null, "password" => null,
"confirmpassword" => null, "confirmpassword" => null,
"message" => "Username already used", "flashMessages" => [["Username already used"]],
"formstatus" => "error" "formstatus" => "error"
) )
); );
...@@ -73,7 +73,7 @@ class CreateUserAction extends UserAction ...@@ -73,7 +73,7 @@ class CreateUserAction extends UserAction
"contaminated" => $contaminated, "contaminated" => $contaminated,
"password" => null, "password" => null,
"confirmpassword" => null, "confirmpassword" => null,
"message" => "Mail already used", "flashMessages" => [["Mail already used"]],
"formstatus" => "error" "formstatus" => "error"
) )
); );
...@@ -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('message', 'Your account has been created. Please log in.'); $this->flash->addMessage('creation', 'Your account has been created. Please log in.');
return $this->response return $this->response
->withHeader('Location', '/login') ->withHeader('Location', '/login')
->withStatus(302); ->withStatus(302);
......
...@@ -20,15 +20,15 @@ class LogInUserAction extends UserAction ...@@ -20,15 +20,15 @@ class LogInUserAction extends UserAction
$user = $this->userRepository->findOneBy(array('username' => $username)); $user = $this->userRepository->findOneBy(array('username' => $username));
if (!isset($user)) { if (!isset($user)) {
$this->flash->addMessage('signup', 'Please sign up.'); $this->flash->addMessage('flashMessages', 'Unknown username or password.');
return $this->response return $this->response
->withHeader('Location', '/signup') ->withHeader('Location', '/login')
->withStatus(302); ->withStatus(302);
} }
if (!password_verify($password, $user->getPassword())) { if (!password_verify($password, $user->getPassword())) {
$_SESSION['message'] = 'Username or password unknown.'; $_SESSION['message'] = 'Unknown username or password.';
return $this->twig->render($this->response, "/user/log_in.twig", ["formstatus" => "error", "session" => $_SESSION]); return $this->twig->render($this->response, "/user/log_in.twig", ["formstatus" => "error", "session" => $_SESSION]);
} }
......
...@@ -30,7 +30,7 @@ class NearContaminatedUsers extends UserAction ...@@ -30,7 +30,7 @@ class NearContaminatedUsers extends UserAction
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('flashMessages', 'Please log in or sign up.');
return $this->response return $this->response
->withHeader('Location', '/login') ->withHeader('Location', '/login')
......
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