From f68987bfb98aee5593321871f6f74427415a63fc Mon Sep 17 00:00:00 2001 From: Adegoke David <64401859+Blazebrain@users.noreply.github.com> Date: Sat, 27 Jan 2024 04:08:53 +0100 Subject: [PATCH] CW-566-Cake2FA-Bypass-Bug (#1275) * fix: TOTP 2FA Bug * fix: key switch error * Fix 2fa preset issue --------- Co-authored-by: OmarHatem --- lib/store/settings_store.dart | 4 ++-- lib/view_model/set_up_2fa_viewmodel.dart | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/store/settings_store.dart b/lib/store/settings_store.dart index e792ee3b0..0ffedec90 100644 --- a/lib/store/settings_store.dart +++ b/lib/store/settings_store.dart @@ -997,7 +997,7 @@ abstract class SettingsStoreBase with Store { final totpSecretKey = await SecureKey.getString( secureStorage: secureStorage, sharedPreferences: sharedPreferences, - key: SecureKey.useTOTP2FA, + key: SecureKey.totpSecretKey, ) ?? ''; @@ -1243,7 +1243,7 @@ abstract class SettingsStoreBase with Store { totpSecretKey = await SecureKey.getString( secureStorage: _secureStorage, sharedPreferences: sharedPreferences, - key: SecureKey.useTOTP2FA, + key: SecureKey.totpSecretKey, ) ?? totpSecretKey; diff --git a/lib/view_model/set_up_2fa_viewmodel.dart b/lib/view_model/set_up_2fa_viewmodel.dart index 9587e3075..7347b32a8 100644 --- a/lib/view_model/set_up_2fa_viewmodel.dart +++ b/lib/view_model/set_up_2fa_viewmodel.dart @@ -27,7 +27,9 @@ abstract class Setup2FAViewModelBase with Store { unhighlightTabs = false, selected2FASettings = ObservableList(), state = InitialExecutionState() { - selectCakePreset(selectedCake2FAPreset); + if (selectedCake2FAPreset != Cake2FAPresetsOptions.none) { + selectCakePreset(selectedCake2FAPreset); + } reaction((_) => state, _saveLastAuthTime); }