1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-29 07:50:29 +02:00

Flextype Box Plugin: Admin #125 #117

- AuthMiddleware updates
This commit is contained in:
Awilum
2019-06-07 14:24:48 +03:00
parent cc50d96978
commit 61647f9396

View File

@@ -2,10 +2,18 @@
namespace Flextype;
use Flextype\Component\Session\Session;
class AuthMiddleware extends Middleware
{
public function __invoke($request, $response, $next)
{
die('auth');
if (Session::exists('role') && Session::get('role') == 'admin') {
$response = $next($request, $response);
} else {
$response = $response->withRedirect($this->router->pathFor('admin.users.login'));
}
return $response;
}
}