Renvoi de la bonne config

This commit is contained in:
nox 2019-10-25 20:46:05 +02:00
parent 0222bac963
commit 529b80375f
4 changed files with 18 additions and 8 deletions

3
.gitignore vendored
View File

@ -1,6 +1,7 @@
config/config.php
config/conf.php
.idea
/public/uploads
/tmp
vendor
composer.json
composer.lock

View File

@ -1,7 +1,5 @@
<?php
$host = 'localhost';
//$username = 'guser';
$username = 'root';
//$password = 'kptgT81U7nzYWHBdQ9';
$password = 'root';
$username = 'guser';
$password = 'kptgT81U7nzYWHBdQ9';
$database_name = 'gmarche';

View File

@ -22,7 +22,8 @@ use Middlewares\Whoops;
chdir(dirname(__DIR__));
require 'vendor/autoload.php';
$chemin = $_SERVER['DOCUMENT_ROOT'];
$chemin_new = substr($chemin,0,-7);
$chemin_new = substr($chemin,0,-6);
$app = (new \Framework\App( $chemin_new .'/config/config.php'))
//$app = (new \Framework\App( '../config/config.php'))
->addModule(AdminModule::class)

View File

@ -5,8 +5,13 @@ use App\Auth\DatabaseAuth;
use Framework\Renderer\RendererInterface;
use Framework\Response\RedirectResponse;
use Framework\Session\FlashService;
use Psr\Container\ContainerInterface;
use Psr\Http\Message\ServerRequestInterface;
/**
* Class LogoutAction
* @package App\Auth\Action
*/
class LogoutAction
{
@ -23,17 +28,22 @@ class LogoutAction
*/
private $flashService;
public function __construct(RendererInterface $renderer, DatabaseAuth $auth, FlashService $flashService)
private $container;
public function __construct(RendererInterface $renderer, DatabaseAuth $auth, FlashService $flashService
, ContainerInterface $container)
{
$this->renderer = $renderer;
$this->auth = $auth;
$this->flashService = $flashService;
$this->container = $container;
}
public function __invoke(ServerRequestInterface $request)
{
$gmarchePrefix = $this->container->get('gmarche.prefix');
$this->auth->logout();
$this->flashService->success('Vous êtes maintenant déconnecté');
return new RedirectResponse('/gmarche');
return new RedirectResponse("$gmarchePrefix");
}
}