identification
This commit is contained in:
2
SRC/app/Http/Middleware/Authenticate.php
Normal file → Executable file
2
SRC/app/Http/Middleware/Authenticate.php
Normal file → Executable file
@ -40,7 +40,7 @@ class Authenticate {
|
||||
}
|
||||
else
|
||||
{
|
||||
return redirect()->guest('auth/login');
|
||||
return redirect()->guest('login');
|
||||
}
|
||||
}
|
||||
|
||||
|
2
SRC/app/Http/Middleware/RedirectIfAuthenticated.php
Normal file → Executable file
2
SRC/app/Http/Middleware/RedirectIfAuthenticated.php
Normal file → Executable file
@ -35,7 +35,7 @@ class RedirectIfAuthenticated {
|
||||
{
|
||||
if ($this->auth->check())
|
||||
{
|
||||
return new RedirectResponse(url('/home'));
|
||||
return new RedirectResponse(url('/referent'));
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
|
45
SRC/app/Http/Middleware/RedirectIfNotAdmin.php
Normal file
45
SRC/app/Http/Middleware/RedirectIfNotAdmin.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Auth;
|
||||
|
||||
|
||||
class RedirectIfNotAdmin {
|
||||
|
||||
/**
|
||||
* The Guard implementation.
|
||||
*
|
||||
* @var Guard
|
||||
*/
|
||||
protected $auth;
|
||||
|
||||
/**
|
||||
* Create a new filter instance.
|
||||
*
|
||||
* @param Guard $auth
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Guard $auth)
|
||||
{
|
||||
$this->auth = $auth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if (!$this->auth->check() OR Auth::user()->admin == 0)
|
||||
{
|
||||
return new RedirectResponse(url('/login'));
|
||||
}
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
}
|
0
SRC/app/Http/Middleware/VerifyCsrfToken.php
Normal file → Executable file
0
SRC/app/Http/Middleware/VerifyCsrfToken.php
Normal file → Executable file
Reference in New Issue
Block a user