Fix tests
This commit is contained in:
parent
5129149c6c
commit
43d731fb49
|
@ -4,6 +4,7 @@ namespace App\Http\Middleware;
|
||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Tymon\JWTAuth\Exceptions\JWTException;
|
||||||
|
|
||||||
class ImpersonationMiddleware
|
class ImpersonationMiddleware
|
||||||
{
|
{
|
||||||
|
@ -64,10 +65,14 @@ class ImpersonationMiddleware
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next)
|
public function handle(Request $request, Closure $next)
|
||||||
{
|
{
|
||||||
if (!auth()->check() ||
|
try {
|
||||||
!auth()->payload()->get('impersonating')) {
|
if (!auth()->check() || !auth()->payload()->get('impersonating')) {
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
} catch (JWTException $e) {
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
|
||||||
// Check that route is allowed
|
// Check that route is allowed
|
||||||
$routeName = $request->route()->getName();
|
$routeName = $request->route()->getName();
|
||||||
if (!in_array($routeName, self::ALLOWED_ROUTES)) {
|
if (!in_array($routeName, self::ALLOWED_ROUTES)) {
|
||||||
|
|
Loading…
Reference in New Issue