diff options
author | Igor Scheller <igor.scheller@igorshp.de> | 2018-10-08 19:30:37 +0200 |
---|---|---|
committer | msquare <msquare@notrademark.de> | 2018-10-31 13:43:23 +0100 |
commit | d15946df2dfb0ae2f0ca9371e5c8071df91ab45a (patch) | |
tree | 49601aafd74da5a781920543ed92bbd180fe5e89 /src/Middleware/LegacyMiddleware.php | |
parent | 8e62c4c52c27f9432820915deeb699c3d1f58ce7 (diff) |
Changed `src/` code and templates to use the new user model
Diffstat (limited to 'src/Middleware/LegacyMiddleware.php')
-rw-r--r-- | src/Middleware/LegacyMiddleware.php | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/Middleware/LegacyMiddleware.php b/src/Middleware/LegacyMiddleware.php index 4f61ad32..ce1eadef 100644 --- a/src/Middleware/LegacyMiddleware.php +++ b/src/Middleware/LegacyMiddleware.php @@ -2,6 +2,7 @@ namespace Engelsystem\Middleware; +use Engelsystem\Helpers\Authenticator; use Engelsystem\Helpers\Translator; use Engelsystem\Http\Request; use Engelsystem\Http\Response; @@ -35,12 +36,17 @@ class LegacyMiddleware implements MiddlewareInterface /** @var ContainerInterface */ protected $container; + /** @var Authenticator */ + protected $auth; + /** * @param ContainerInterface $container + * @param Authenticator $auth */ - public function __construct(ContainerInterface $container) + public function __construct(ContainerInterface $container, Authenticator $auth) { $this->container = $container; + $this->auth = $auth; } /** @@ -56,7 +62,6 @@ class LegacyMiddleware implements MiddlewareInterface ServerRequestInterface $request, RequestHandlerInterface $handler ): ResponseInterface { - global $user; global $privileges; global $page; @@ -68,7 +73,7 @@ class LegacyMiddleware implements MiddlewareInterface $page = str_replace('-', '_', $page); } if ($page == '/') { - $page = isset($user) ? 'news' : 'login'; + $page = $this->auth->user() ? 'news' : 'login'; } $title = $content = ''; |