guest()) { if ($request->ajax()) { return response('Unauthorized.', 401); } return redirect()->guest('login'); } if (intval(Auth::user()->blocked) === 1) { Auth::guard($guard)->logout(); Session::flash('logoutMessage', trans('firefly.block_account_logout')); return redirect()->guest('login'); } $is2faEnabled = Preferences::get('twoFactorAuthEnabled', false)->data; $has2faSecret = !is_null(Preferences::get('twoFactorAuthSecret')); $is2faAuthed = Session::get('twofactor-authenticated'); if ($is2faEnabled && $has2faSecret && !$is2faAuthed) { return redirect(route('two-factor')); } return $next($request); } }