mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-10 07:34:06 -08:00
Check for setup to have completed before running the 2fa middleware. Otherwise new installs fail (#2885)
This commit is contained in:
parent
96ad5fb77b
commit
f4fc783026
|
@ -1,9 +1,11 @@
|
|||
<?php
|
||||
namespace App\Http\Middleware;
|
||||
use Closure;
|
||||
use Auth;
|
||||
use Log;
|
||||
|
||||
use App\Models\Setting;
|
||||
use Auth;
|
||||
use Closure;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Log;
|
||||
|
||||
class CheckForTwoFactor
|
||||
{
|
||||
|
@ -23,6 +25,7 @@ class CheckForTwoFactor
|
|||
}
|
||||
|
||||
// Two-factor is enabled (either optional or required)
|
||||
if (Schema::hasTable('settings')) {
|
||||
if (Auth::check() && (Setting::getSettings()->two_factor_enabled!='')) {
|
||||
|
||||
// This user is already 2fa-authed
|
||||
|
@ -41,10 +44,8 @@ class CheckForTwoFactor
|
|||
}
|
||||
|
||||
return redirect()->route('two-factor-enroll')->with('success', 'Please enroll a device in two-factor authentication.');
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return $next($request);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue