mirror of
https://github.com/flextype/flextype.git
synced 2025-08-29 07:50:29 +02:00
@@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user