E-Mail-Verifizierung (Entscheidung 15.06.): - User implementiert MustVerifyEmail; Registrierung legt inaktives, rollenloses Konto an und leitet auf die Danke-/Notice-Seite; Registered-Event versendet die Verifizierungsmail. Bestätigter Link aktiviert das Konto + vergibt customer-Rolle (ActivateUserAfterVerification). Backfill-Migration setzt email_verified_at für alle Bestands-User (sonst würde die verified-Middleware ~59k aktive Legacy-User aussperren). Seeder-User verifiziert. Auth-Flow-Korrekturen: - Magic-Link-Consume: rollensicherer Redirect ohne intended() (Customer landete sonst per stale intended=/dashboard im 403-Admin-Bereich). - Guest-Redirect (bootstrap/app.php) rollen-/verifizierungsbewusst statt fix /dashboard – schließt die 403-Sackgasse auf /login und /register. - Logout auf der Notice-Seite via echtes POST-Formular statt Livewire-Action (behebt 419 beim Session-Invalidate). - Magic-Link-Anforderung über eigenes Modal mit separater E-Mail-Eingabe. - Unverifizierte Login-Versuche landen auf der Notice-Seite. Sicherheitsfix Legacy-Rollen: - UserImporter mappte Alt-Gruppe 2 (Self-Publisher) auf editor (= Admin-Zugriff). Mapping auf customer korrigiert; Daten-Migration stuft die 65.950 fälschlichen Legacy-Editoren auf customer herab. Echte admin/api-only bleiben unberührt. Tests: Registration, EmailVerification, Authentication (Guest-Redirect), MagicLinkLogin (Modal/Redirect/Regression), Legacy-Import (Gruppen-Mapping). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
61 lines
2.3 KiB
PHP
61 lines
2.3 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');
|
|
|
|
// 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');
|
|
|
|
// 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');
|
|
});
|