You've already forked Atomcms-edit
0b6f14d5bf
- Centralize all CDN URLs in config('habbo.cdn.*') with env overrides
- Replace hardcoded CDN URLs in 12+ blade views (fancybox, sweetalert2,
alpinejs, fontsource, fontawesome, html2canvas)
- Fix font-awesome 7.0.0 (non-existent) -> config with 6.7.0 default
- Centralize all hardcoded min_staff_rank defaults (3 and 7) to config
- Add MIN_STAFF_RANK and MIN_STAFF_RANK_LOGIN env variables
31 lines
828 B
PHP
Executable File
31 lines
828 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
use Closure;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Auth;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
|
|
class ForceStaffTwoFactorMiddleware
|
|
{
|
|
public function handle(Request $request, Closure $next): Response
|
|
{
|
|
if (! Auth::check() || ! setting('force_staff_2fa')) {
|
|
return $next($request);
|
|
}
|
|
|
|
$user = $request->user();
|
|
$allowedRoutes = [
|
|
'settings.two-factor',
|
|
'two-factor.verify',
|
|
];
|
|
|
|
if (($user->rank >= setting('min_staff_rank', config('habbo.defaults.min_staff_rank')) && ! $user->two_factor_confirmed) && ! in_array(request()->route()?->getName(), $allowedRoutes)) {
|
|
return to_route('settings.two-factor');
|
|
}
|
|
|
|
return $next($request);
|
|
}
|
|
}
|