WS-6: E-Mail-Verifizierung, Auth-Flow-Fixes & Legacy-Rollen-Sicherheitsfix
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>
This commit is contained in:
parent
c804f3bfc3
commit
94cb209a9f
18 changed files with 608 additions and 86 deletions
|
|
@ -1,6 +1,7 @@
|
|||
<?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;
|
||||
|
|
@ -31,11 +32,24 @@ Route::group(['middleware' => config('fortify.middleware', ['web'])], function (
|
|||
->middleware(['guest:'.config('fortify.guard')])
|
||||
->name('password.reset');
|
||||
|
||||
// E-Mail-Verifizierung mit Livewire
|
||||
// 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')])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue