diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 61d14dcf5..209295e75 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -22,6 +22,7 @@ class Kernel extends HttpKernel \App\Http\Middleware\NosniffGuard::class, \App\Http\Middleware\CheckForSetup::class, \Fideloper\Proxy\TrustProxies::class, + \App\Http\Middleware\GetAppSettings::class, ]; /** diff --git a/app/Http/Middleware/CheckForTwoFactor.php b/app/Http/Middleware/CheckForTwoFactor.php index 476e9fdd5..61dcf5269 100644 --- a/app/Http/Middleware/CheckForTwoFactor.php +++ b/app/Http/Middleware/CheckForTwoFactor.php @@ -19,13 +19,13 @@ class CheckForTwoFactor public function handle($request, Closure $next) { - // Skip the logic if the user is on the two factor pages - if (($request->route()->getName()=='two-factor') || ($request->route()->getName()=='two-factor-enroll') || ($request->route()->getName()=='logout')) { + // Skip the logic if the user is on the two factor pages or the setup pages + if (($request->route()->getName()=='two-factor') || ($request->route()->getName()=='two-factor-enroll') || ($request->route()->getPrefix()=='setup') || ($request->route()->getName()=='logout')) { return $next($request); } // Two-factor is enabled (either optional or required) - if (Schema::hasTable('settings')) { + if (Setting::getSettings()) { if (Auth::check() && (Setting::getSettings()->two_factor_enabled!='')) { // This user is already 2fa-authed diff --git a/app/Http/Middleware/GetAppSettings.php b/app/Http/Middleware/GetAppSettings.php new file mode 100644 index 000000000..e8340e8ff --- /dev/null +++ b/app/Http/Middleware/GetAppSettings.php @@ -0,0 +1,24 @@ +share('app_settings', $app_settings); + return $next($request); + } +}