Magic-Link und Pressekontakt-Zugang zu einer Seite (/anmeldelink) zusammengeführt; altes Login-Modal entfernt, /pressekontakt-zugang leitet weiter. - ContactAccessService deckt jetzt Firmen-E-Mail UND Pressekontakt-E-Mail ab, portalübergreifend (ohne PortalScope). Eine E-Mail mehrfach hinterlegt → genau ein Account, dem alle Firmen + Kontakte zugeordnet werden. - Zugeordnete Firmen erhalten Pivot-Rolle 'responsible' (Schreibzugriff auf Stammdaten, Kontakte, Pressemitteilungen) statt nur 'member'; bestehende Lese-Pivots werden hochgestuft, Owner bleiben unangetastet. - Neuer Login-Listener (SyncCompanyMembershipsOnLogin) frischt die Zuordnungen bei JEDEM Login (Magic-Link, Passwort, Google) auf – auch nachträglich (API) hinzugekommene Firmen/Kontakte mit gleicher E-Mail greifen. - Auth-Bereich erzwingt Hellmodus: aus dem Portal übernommene .dark-Klasse wird am <html> entfernt (Login war im Dark Mode hängengeblieben). - Tests: Firmen-E-Mail-Login, Multi-Firmen-Aggregation, Schreibzugriff/Upgrade, Per-Login-Re-Sync, Auth-Hellmodus. Sicherheits-Doku aktualisiert. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
86 lines
3.5 KiB
PHP
86 lines
3.5 KiB
PHP
<?php
|
|
|
|
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')])
|
|
->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');
|
|
|
|
// 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');
|
|
});
|