From 09fb36492367d36852c7131ab65eeaaf07431f2e Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 25 Aug 2026 17:34:23 +0200 Subject: [PATCH] Fix some MFA details. --- app/Http/Controllers/Auth/TwoFactorController.php | 10 +++++----- app/Http/Controllers/Profile/MfaController.php | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/Auth/TwoFactorController.php b/app/Http/Controllers/Auth/TwoFactorController.php index 82baf43ed9..b603695b14 100644 --- a/app/Http/Controllers/Auth/TwoFactorController.php +++ b/app/Http/Controllers/Auth/TwoFactorController.php @@ -65,7 +65,7 @@ final class TwoFactorController extends Controller public function submitMFA(Request $request): RedirectResponse { /** @var array $mfaHistory */ - $mfaHistory = Preferences::get('mfa_history', [])->data; + $mfaHistory = Preferences::get('mfa_history', [], true)->data; $mfaCode = (string) $request->input('one_time_password'); // is in history? then refuse to use it. @@ -127,7 +127,7 @@ final class TwoFactorController extends Controller private function addToMFAFailureCounter(): void { - $preference = (int) Preferences::get('mfa_failure_count', 0)->data; + $preference = (int) Preferences::get('mfa_failure_count', 0, true)->data; ++$preference; Log::channel('audit')->info(sprintf('MFA failure count is set to %d.', $preference)); Preferences::set('mfa_failure_count', $preference, true); @@ -136,7 +136,7 @@ final class TwoFactorController extends Controller private function addToMFAHistory(string $mfaCode): void { /** @var array $mfaHistory */ - $mfaHistory = Preferences::get('mfa_history', [])->data; + $mfaHistory = Preferences::get('mfa_history', [], true)->data; $entry = ['time' => Carbon::now()->getTimestamp(), 'code' => $mfaCode]; $mfaHistory[] = $entry; @@ -150,7 +150,7 @@ final class TwoFactorController extends Controller private function filterMFAHistory(): void { /** @var array $mfaHistory */ - $mfaHistory = Preferences::get('mfa_history', [])->data; + $mfaHistory = Preferences::get('mfa_history', [], true)->data; $newHistory = []; $now = Carbon::now()->getTimestamp(); foreach ($mfaHistory as $entry) { @@ -165,7 +165,7 @@ final class TwoFactorController extends Controller private function getMFAFailureCounter(): int { - $value = (int) Preferences::get('mfa_failure_count', 0)->data; + $value = (int) Preferences::get('mfa_failure_count', 0, true)->data; Log::channel('audit')->info(sprintf('MFA failure count is %d.', $value)); return $value; diff --git a/app/Http/Controllers/Profile/MfaController.php b/app/Http/Controllers/Profile/MfaController.php index 8f53d4e652..42a365a900 100644 --- a/app/Http/Controllers/Profile/MfaController.php +++ b/app/Http/Controllers/Profile/MfaController.php @@ -297,7 +297,7 @@ final class MfaController extends Controller private function addToMFAHistory(string $mfaCode): void { /** @var array $mfaHistory */ - $mfaHistory = Preferences::get('mfa_history', [])->data; + $mfaHistory = Preferences::get('mfa_history', [], true)->data; $entry = ['time' => Carbon::now()->getTimestamp(), 'code' => $mfaCode]; $mfaHistory[] = $entry; @@ -311,7 +311,7 @@ final class MfaController extends Controller private function filterMFAHistory(): void { /** @var array $mfaHistory */ - $mfaHistory = Preferences::get('mfa_history', [])->data; + $mfaHistory = Preferences::get('mfa_history', [], true)->data; $newHistory = []; $now = Carbon::now()->getTimestamp(); foreach ($mfaHistory as $entry) {