mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-01-01 11:47:14 -06:00
Middleware does not fire when user is not logged in.
This commit is contained in:
parent
707af8bb4e
commit
4b869f0d9e
@ -45,12 +45,9 @@ class IsDemoUser
|
|||||||
public function handle(Request $request, Closure $next, $guard = null)
|
public function handle(Request $request, Closure $next, $guard = null)
|
||||||
{
|
{
|
||||||
if (Auth::guard($guard)->guest()) {
|
if (Auth::guard($guard)->guest()) {
|
||||||
if ($request->ajax()) {
|
// don't care when not logged in, usual stuff applies:
|
||||||
return response('Unauthorized.', 401);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->guest('login');
|
|
||||||
}
|
|
||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
if ($user->hasRole('demo')) {
|
if ($user->hasRole('demo')) {
|
||||||
|
@ -45,11 +45,8 @@ class IsSandStormUser
|
|||||||
public function handle(Request $request, Closure $next, $guard = null)
|
public function handle(Request $request, Closure $next, $guard = null)
|
||||||
{
|
{
|
||||||
if (Auth::guard($guard)->guest()) {
|
if (Auth::guard($guard)->guest()) {
|
||||||
if ($request->ajax()) {
|
// don't care when not logged in, usual stuff applies:
|
||||||
return response('Unauthorized.', 401);
|
return $next($request);
|
||||||
}
|
|
||||||
|
|
||||||
return redirect()->guest('login');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (1 === intval(getenv('SANDSTORM'))) {
|
if (1 === intval(getenv('SANDSTORM'))) {
|
||||||
|
Loading…
Reference in New Issue
Block a user