Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fix some MFA details.
James Cole09fb36492367
diff --git a/app/Http/Controllers/Auth/TwoFactorController.php b/app/Http/Controllers/Auth/TwoFactorController.phpindex 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 Controllerpublic 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 Controllerprivate 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 Controllerprivate 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 Controllerprivate 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 Controllerprivate 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.phpindex 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 Controllerprivate 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 Controllerprivate 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) {