Redirect landing to login, add registration toggle

Changes:
- Landing page (/) now redirects to /login
- Added 'Enable User Registration' setting (off by default)
- Created CheckRegistrationEnabled middleware
- Registration routes blocked when setting is disabled
- Admin can toggle registration in Settings > System
This commit is contained in:
2026-03-11 07:43:25 +02:00
parent 4b2ff91ac4
commit cf6079d58c
6 changed files with 44 additions and 5 deletions

View File

@@ -0,0 +1,26 @@
<?php
namespace App\Http\Middleware;
use App\Models\Setting;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
class CheckRegistrationEnabled
{
/**
* Handle an incoming request.
* Block registration routes if registration is disabled in settings.
*/
public function handle(Request $request, Closure $next): Response
{
$registrationEnabled = Setting::get('enable_registration', false);
if (!$registrationEnabled) {
abort(403, 'User registration is currently disabled. Please contact an administrator.');
}
return $next($request);
}
}