user(); $this->email = (string) $user->email; $this->confirmedTwoFactor = ! is_null($user->two_factor_confirmed_at ?? null); } public function updatePassword(): void { try { $validated = $this->validate([ 'current_password' => ['required', 'string', 'current_password'], 'password' => ['required', 'string', Password::defaults(), 'confirmed'], ]); } catch (ValidationException $e) { $this->reset('current_password', 'password', 'password_confirmation'); throw $e; } Auth::user()->forceFill([ 'password' => Hash::make($validated['password']), ])->save(); $this->reset('current_password', 'password', 'password_confirmation'); session()->flash('security-status', __('Passwort aktualisiert.')); } public function updateEmail(): void { $validated = $this->validate([ 'email' => [ 'required', 'email', 'max:190', Rule::unique(User::class, 'email')->ignore(auth()->id()), ], ]); /** @var User $user */ $user = auth()->user(); $user->forceFill([ 'email' => $validated['email'], 'email_verified_at' => null, ])->save(); if (Features::enabled(Features::emailVerification())) { $user->sendEmailVerificationNotification(); } session()->flash('security-status', __('E-Mail-Adresse aktualisiert. Bitte erneut bestätigen, falls eine Verifizierung verschickt wurde.')); } public function enableTwoFactorAuthentication(EnableTwoFactorAuthentication $enable): void { $enable(auth()->user()); session()->flash('security-status', __('Zwei-Faktor-Authentifizierung aktiviert. Scannen Sie den QR-Code mit Ihrer Authenticator-App.')); } public function disableTwoFactorAuthentication(DisableTwoFactorAuthentication $disable): void { $disable(auth()->user()); $this->confirmedTwoFactor = false; session()->flash('security-status', __('Zwei-Faktor-Authentifizierung deaktiviert.')); } public function regenerateRecoveryCodes(GenerateNewRecoveryCodes $generate): void { $generate(auth()->user()); session()->flash('security-status', __('Neue Wiederherstellungs-Codes erzeugt.')); } public function with(): array { /** @var User $user */ $user = auth()->user(); $user->refresh(); $qrUrl = null; $recoveryCodes = []; if (! is_null($user->two_factor_secret ?? null) && Features::enabled(Features::twoFactorAuthentication())) { try { $qrUrl = $user->twoFactorQrCodeSvg(); $recoveryCodes = json_decode(decrypt($user->two_factor_recovery_codes), true) ?: []; } catch (\Throwable) { $qrUrl = null; $recoveryCodes = []; } } return [ 'user' => $user, 'twoFactorEnabled' => ! is_null($user->two_factor_secret ?? null), 'twoFactorQrSvg' => $qrUrl, 'recoveryCodes' => $recoveryCodes, 'sessions' => DB::table('sessions') ->where('user_id', $user->id) ->orderByDesc('last_activity') ->limit(5) ->get(['id', 'ip_address', 'user_agent', 'last_activity']), ]; } }; ?>
{{-- ============== PAGE HEADER ============== --}} @if (session('security-status'))
{{ session('security-status') }}
@endif {{-- ============== KPI-Reihe ============== --}}
{{ __('E-Mail') }}
{{ $user->email }}
@if ($user->email_verified_at) {{ __('Bestätigt') }} @else {{ __('Nicht bestätigt') }} @endif
{{ __('Zwei-Faktor') }}
{{ $twoFactorEnabled ? __('Aktiv') : __('Nicht aktiv') }}
@if ($twoFactorEnabled) {{ __('Zusatzschutz aktiv') }} @else {{ __('Empfohlen') }} @endif
{{ __('Letzter Login') }}
{{ $user->last_login_at?->format('d.m.Y H:i') ?? __('Unbekannt') }}
{{ $user->last_login_ip ?: __('Keine IP gespeichert') }}
{{ __('Aktive Sessions') }}
{{ $sessions->count() }}
{{ __('Aus den aktuellen Web-Sessions') }}
{{ __('Passwort ändern') }}
{{ __('Passwort speichern') }}
{{ __('E-Mail-Adresse ändern') }}

{{ __('Nach der Änderung kann eine erneute Bestätigung der E-Mail-Adresse erforderlich sein.') }}

{{ __('E-Mail speichern') }}
{{ __('Zwei-Faktor-Authentifizierung') }} @if ($twoFactorEnabled) {{ __('Aktiv') }} @endif
@if (! $twoFactorEnabled)

{{ __('Schützen Sie Ihren Account zusätzlich mit einer Authenticator-App (TOTP).') }}

{{ __('Zwei-Faktor-Authentifizierung aktivieren') }} @else @if ($twoFactorQrSvg)
{{-- QR-Code: bg-white ist BEWUSST konstant in beiden Modi — QR-Codes brauchen schwarz-auf-weiß für zuverlässiges Scannen. --}}
{!! $twoFactorQrSvg !!}

{{ __('Scannen Sie den QR-Code mit Ihrer Authenticator-App (z. B. 1Password, Google Authenticator).') }}

@if (! empty($recoveryCodes))
{{ __('Wiederherstellungs-Codes') }}
    @foreach ($recoveryCodes as $code)
  • {{ $code }}
  • @endforeach
@endif
@endif
{{ __('Neue Wiederherstellungs-Codes erzeugen') }} {{ __('Zwei-Faktor deaktivieren') }}
@endif
{{ __('Aktive Sessions') }} {{ $sessions->count() }} {{ __('Einträge') }}

{{ __('Hier sehen Sie die letzten bekannten Web-Sessions Ihres Kontos. Abmelden erfolgt aktuell über das Nutzer-Menü.') }}

@forelse ($sessions as $session)
{{ $session->ip_address ?: __('IP unbekannt') }}
{{ Str::limit($session->user_agent ?: __('User-Agent unbekannt'), 120) }}
{{ \Carbon\Carbon::createFromTimestamp($session->last_activity)->diffForHumans() }}
@empty
{{ __('Keine Sessions gefunden') }}

{{ __('Sobald Sessions protokolliert werden, erscheinen sie hier.') }}

@endforelse