canManageTwoFactor = Features::canManageTwoFactorAuthentication(); if ($this->canManageTwoFactor) { if (Fortify::confirmsTwoFactorAuthentication() && is_null(auth()->user()->two_factor_confirmed_at)) { $disableTwoFactorAuthentication(auth()->user()); } $this->twoFactorEnabled = auth()->user()->hasEnabledTwoFactorAuthentication(); $this->requiresConfirmation = Features::optionEnabled(Features::twoFactorAuthentication(), 'confirm'); } } /** * Update the password for the currently authenticated user. */ public function updatePassword(): void { try { $validated = $this->validate([ 'current_password' => $this->currentPasswordRules(), 'password' => $this->passwordRules(), ]); } catch (ValidationException $e) { $this->reset('current_password', 'password', 'password_confirmation'); throw $e; } Auth::user()->update([ 'password' => $validated['password'], ]); $this->reset('current_password', 'password', 'password_confirmation'); $this->dispatch('password-updated'); } /** * Handle the two-factor authentication enabled event. */ #[On('two-factor-enabled')] public function onTwoFactorEnabled(): void { $this->twoFactorEnabled = true; } /** * Disable two-factor authentication for the user. */ public function disable(DisableTwoFactorAuthentication $disableTwoFactorAuthentication): void { $disableTwoFactorAuthentication(auth()->user()); $this->twoFactorEnabled = false; } }; ?>
@include('partials.settings-heading') {{ __('Security settings') }}
{{ __('Save') }}
{{ __('Saved.') }}
@if ($canManageTwoFactor)
{{ __('Two-factor authentication') }} {{ __('Manage your two-factor authentication settings') }}
@if ($twoFactorEnabled)
{{ __('You will be prompted for a secure, random pin during login, which you can retrieve from the TOTP-supported application on your phone.') }}
{{ __('Disable 2FA') }}
@else
{{ __('When you enable two-factor authentication, you will be prompted for a secure pin during login. This pin can be retrieved from a TOTP-supported application on your phone.') }} {{ __('Enable 2FA') }}
@endif
@endif