diff --git a/app/Http/Middleware/IsDemoUser.php b/app/Http/Middleware/IsDemoUser.php index 2069796235..1f924b7dce 100644 --- a/app/Http/Middleware/IsDemoUser.php +++ b/app/Http/Middleware/IsDemoUser.php @@ -45,12 +45,9 @@ class IsDemoUser public function handle(Request $request, Closure $next, $guard = null) { if (Auth::guard($guard)->guest()) { - if ($request->ajax()) { - return response('Unauthorized.', 401); - } - - return redirect()->guest('login'); - } + // don't care when not logged in, usual stuff applies: + return $next($request); + } /** @var User $user */ $user = auth()->user(); if ($user->hasRole('demo')) { diff --git a/app/Http/Middleware/IsSandStormUser.php b/app/Http/Middleware/IsSandStormUser.php index 6359e82ed2..81032bded6 100644 --- a/app/Http/Middleware/IsSandStormUser.php +++ b/app/Http/Middleware/IsSandStormUser.php @@ -45,11 +45,8 @@ class IsSandStormUser public function handle(Request $request, Closure $next, $guard = null) { if (Auth::guard($guard)->guest()) { - if ($request->ajax()) { - return response('Unauthorized.', 401); - } - - return redirect()->guest('login'); + // don't care when not logged in, usual stuff applies: + return $next($request); } if (1 === intval(getenv('SANDSTORM'))) {