user(); if ($operator === null || $operator->two_factor_confirmed_at !== null) { return $next($request); } // The two pages that must stay reachable: where two-factor is // enrolled, and signing out. Both through AdminArea::routeIs(), not // a bare $request->routeIs() — a recovery hostname's routes are // named admin.viaN.*, and a bare check matches only the canonical // name, which would leave an unenrolled operator unable to sign out // on exactly the host that exists because the canonical one is not // working. if (AdminArea::routeIs('admin.two-factor-setup') || AdminArea::routeIs('admin.logout')) { return $next($request); } return redirect()->route('admin.two-factor-setup') ->with('status', __('admin_settings.two_factor_required')); } }