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
protected function action(): Response
{
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
->withHeader('Location', '/login')
......
......@@ -17,7 +17,7 @@ class CreateGroupAction extends GroupAction
$parsedRequestBody = (array)$this->request->getParsedBody();
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
->withHeader('Location', '/login')
......@@ -36,7 +36,7 @@ class CreateGroupAction extends GroupAction
"name" => $groupname,
"description" => $description,
"private" => $private,
"message" => "Groupname already exist",
"flashMessages" => [["Groupname already exist"]],
"formstatus" => "error"
)
);
......
......@@ -15,7 +15,7 @@ class DeleteGroupAction extends GroupAction
protected function action(): Response
{
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
->withHeader('Location', '/login')
......
......@@ -14,7 +14,7 @@ class ViewModifyGroupForm extends GroupAction
protected function action(): Response
{
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
->withHeader('Location', '/login')
......
......@@ -56,7 +56,7 @@ class CreateUserAction extends UserAction
"contaminated" => $contaminated,
"password" => null,
"confirmpassword" => null,
"message" => "Username already used",
"flashMessages" => [["Username already used"]],
"formstatus" => "error"
)
);
......@@ -73,7 +73,7 @@ class CreateUserAction extends UserAction
"contaminated" => $contaminated,
"password" => null,
"confirmpassword" => null,
"message" => "Mail already used",
"flashMessages" => [["Mail already used"]],
"formstatus" => "error"
)
);
......@@ -89,7 +89,7 @@ class CreateUserAction extends UserAction
$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
->withHeader('Location', '/login')
->withStatus(302);
......
......@@ -20,15 +20,15 @@ class LogInUserAction extends UserAction
$user = $this->userRepository->findOneBy(array('username' => $username));
if (!isset($user)) {
$this->flash->addMessage('signup', 'Please sign up.');
$this->flash->addMessage('flashMessages', 'Unknown username or password.');
return $this->response
->withHeader('Location', '/signup')
->withHeader('Location', '/login')
->withStatus(302);
}
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]);
}
......
......@@ -30,7 +30,7 @@ class NearContaminatedUsers extends UserAction
protected function action(): Response
{
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
->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