chore: add phpstan static analysis minimum (#4511)
This commit is contained in:
parent
3f7e2a565f
commit
a1a52754ad
67 changed files with 561 additions and 279 deletions
|
@ -5,6 +5,7 @@ namespace Pterodactyl\Http\Middleware;
|
|||
use Closure;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Http\Request;
|
||||
use Pterodactyl\Models\User;
|
||||
use Prologue\Alerts\AlertsMessageBag;
|
||||
use Pterodactyl\Exceptions\Http\TwoFactorAuthRequiredException;
|
||||
|
||||
|
@ -36,12 +37,17 @@ class RequireTwoFactorAuthentication
|
|||
*/
|
||||
public function handle(Request $request, Closure $next): mixed
|
||||
{
|
||||
/** @var \Pterodactyl\Models\User $user */
|
||||
/** @var User $user */
|
||||
$user = $request->user();
|
||||
$uri = rtrim($request->getRequestUri(), '/') . '/';
|
||||
$current = $request->route()->getName();
|
||||
|
||||
if (!$user || Str::startsWith($uri, ['/auth/']) || Str::startsWith($current, ['auth.', 'account.'])) {
|
||||
// Must be logged in
|
||||
if (!$user instanceof User) {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
if (Str::startsWith($uri, ['/auth/']) || Str::startsWith($current, ['auth.', 'account.'])) {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue