Befund (Review 16.06.): Der Volt-Login machte direkt Auth::attempt() und umging Fortifys 2FA-Pipeline (2FA-Bypass); zusätzlich existierte der Fortify-POST /login parallel mit schwächeren Post-Login-Regeln. Fix (Volt-nativ): - Volt-Login prüft Credentials ohne sofortiges Login; bei aktivem 2FA wird der Session-Vertrag login.id/login.remember gesetzt und auf eine neue Volt- 2FA-Challenge-Seite (/two-factor-challenge) geleitet, die an Fortifys bestehenden Controller postet (TOTP + Recovery-Code). - Gemeinsame Post-Login-Logik in App\Support\LoginRedirect (rollengerechtes Home + 403-sicherer intended-Redirect), genutzt von Volt-Login UND Response. - RoleAwareLoginResponse implementiert jetzt LoginResponse UND TwoFactorLoginResponse und erzwingt einheitlich: unverifiziert → Notice, verifiziert-inaktiv → Logout+Fehler, sonst 403-sicherer Redirect. Damit ist auch der direkte Fortify-POST-Pfad gehärtet. Tests: 2FA-Übergabe, Challenge-Guard, voller TOTP-Flow, Fortify-POST blockt inaktive User und hält Customer aus dem Admin-Bereich. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
72 lines
2.9 KiB
PHP
72 lines
2.9 KiB
PHP
<?php
|
|
|
|
use App\Http\Controllers\Auth\MagicLinkConsumeController;
|
|
use App\Http\Controllers\Auth\VerifyEmailController;
|
|
use Illuminate\Support\Facades\Route;
|
|
use Laravel\Fortify\Http\Controllers\AuthenticatedSessionController;
|
|
use Livewire\Volt\Volt;
|
|
|
|
// Fortify-Routen für Authentifizierung mit Livewire
|
|
Route::group(['middleware' => config('fortify.middleware', ['web'])], function () {
|
|
// Login mit Livewire
|
|
Volt::route('/login', 'auth.login')
|
|
->middleware(['guest:'.config('fortify.guard')])
|
|
->name('login');
|
|
|
|
Route::get('/magic-login/{token}', MagicLinkConsumeController::class)
|
|
->middleware(['guest:'.config('fortify.guard')])
|
|
->name('magic-links.consume');
|
|
|
|
// Magic-Link-Zugang für Pressekontakte ohne Account (WS-2)
|
|
Volt::route('/pressekontakt-zugang', 'auth.contact-access')
|
|
->middleware(['guest:'.config('fortify.guard')])
|
|
->name('contact-access.request');
|
|
|
|
// Registrierung mit Livewire
|
|
Volt::route('/register', 'auth.register')
|
|
->middleware(['guest:'.config('fortify.guard')])
|
|
->name('register');
|
|
|
|
// Passwort vergessen mit Livewire
|
|
Volt::route('/forgot-password', 'auth.forgot-password')
|
|
->middleware(['guest:'.config('fortify.guard')])
|
|
->name('password.request');
|
|
|
|
// Passwort zurücksetzen mit Livewire
|
|
Volt::route('/reset-password/{token}', 'auth.reset-password')
|
|
->middleware(['guest:'.config('fortify.guard')])
|
|
->name('password.reset');
|
|
|
|
// E-Mail-Verifizierung: Notice-/Danke-Seite (Volt)
|
|
Volt::route('/verify-email', 'auth.verify-email')
|
|
->middleware(['auth:'.config('fortify.guard')])
|
|
->name('verification.notice');
|
|
|
|
// Signierter Bestätigungslink aus der Verifizierungsmail
|
|
Route::get('/verify-email/{id}/{hash}', VerifyEmailController::class)
|
|
->middleware(['auth:'.config('fortify.guard'), 'signed', 'throttle:6,1'])
|
|
->name('verification.verify');
|
|
|
|
// Bestätigungsmail erneut anfordern
|
|
Route::post('/email/verification-notification', function () {
|
|
request()->user()->sendEmailVerificationNotification();
|
|
|
|
return back()->with('status', 'verification-link-sent');
|
|
})->middleware(['auth:'.config('fortify.guard'), 'throttle:6,1'])
|
|
->name('verification.send');
|
|
|
|
// 2FA-Challenge-Seite (Volt-Frontend für Fortifys two-factor-challenge);
|
|
// der eigentliche POST geht an Fortifys Controller.
|
|
Volt::route('/two-factor-challenge', 'auth.two-factor-challenge')
|
|
->middleware(['guest:'.config('fortify.guard')])
|
|
->name('two-factor.challenge');
|
|
|
|
// Passwort bestätigen mit Livewire
|
|
Volt::route('/confirm-password', 'auth.confirm-password')
|
|
->middleware(['auth:'.config('fortify.guard')])
|
|
->name('password.confirm');
|
|
|
|
// Logout-Route
|
|
Route::post('/logout', [AuthenticatedSessionController::class, 'destroy'])
|
|
->name('logout1');
|
|
});
|