presseportale/routes/auth.php
Kevin Adametz 15387d0a3f QA-Befunde A4: 2FA-Bestätigungsschritt + sicherer E-Mail-Wechsel
- 2FA: Einrichtung verlangt jetzt die Bestätigung mit einem App-Code
  (Fortify confirm-Semantik); vorher blieb two_factor_confirmed_at
  leer und der Login fragte nie nach der Challenge.
- Recovery-Codes nur noch einmalig sichtbar (nach Bestätigung bzw.
  Neu-Erzeugung), nicht mehr bei jedem Seitenaufruf.
- E-Mail-Änderung als Pending-Flow: Bestätigungslink geht an die NEUE
  Adresse, die alte bleibt bis zum Klick aktiv — kein Aussperren durch
  Tippfehler und keine Registrierungs-Notice mehr nach dem Ändern.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 10:53:24 +00:00

93 lines
3.9 KiB
PHP

<?php
use App\Http\Controllers\Auth\ConfirmEmailChangeController;
use App\Http\Controllers\Auth\GoogleController;
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'), 'throttle:10,1'])
->name('magic-links.consume');
// Anmeldung per E-Mail-Link (Magic-Link): zusammengeführte Seite für
// Bestandskonten UND hinterlegte Pressekontakte ohne Account (WS-2).
Volt::route('/anmeldelink', 'auth.magic-link')
->middleware(['guest:'.config('fortify.guard')])
->name('magic-link.request');
// Alte Pressekontakt-URL weiterleiten (Bestandslinks/Lesezeichen).
Route::redirect('/pressekontakt-zugang', '/anmeldelink');
// Google-Login (WS-6)
Route::get('/auth/google/redirect', [GoogleController::class, 'redirect'])
->middleware(['guest:'.config('fortify.guard')])
->name('oauth.google.redirect');
Route::get('/auth/google/callback', [GoogleController::class, 'callback'])
->middleware(['guest:'.config('fortify.guard')])
->name('oauth.google.callback');
// 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');
// Signierter Bestätigungslink für eine E-Mail-Änderung (geht an die NEUE
// Adresse; erst der Klick übernimmt sie ins Konto).
Route::get('/email-aendern/{user}/{hash}', ConfirmEmailChangeController::class)
->middleware(['auth:'.config('fortify.guard'), 'signed', 'throttle:6,1'])
->name('email-change.confirm');
// 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');
});