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']), ]; } }; ?>
{{ __('Passwort, E-Mail und Zwei-Faktor-Authentifizierung verwalten.') }}
{{ __('Schützen Sie Ihren Account zusätzlich mit einer Authenticator-App (TOTP).') }}
{{ __('Scannen Sie den QR-Code mit Ihrer Authenticator-App (z. B. 1Password, Google Authenticator).') }}
@if (! empty($recoveryCodes)){{ __('Hier sehen Sie die letzten bekannten Web-Sessions Ihres Kontos. Abmelden erfolgt aktuell über das Nutzer-Menü.') }}
{{ __('Sobald Sessions protokolliert werden, erscheinen sie hier.') }}