CW-566-Cake2FA-Bypass-Bug (#1275)

* fix: TOTP 2FA Bug * fix: key switch error * Fix 2fa preset issue --------- Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>

Adegoke David committed Jan 27, 2024 at 04:08 UTC f68987bfb98aee5593321871f6f74427415a63fc
2 files changed +5 -3
lib/store/settings_store.dart
+2 -2
@@ -997,7 +997,7 @@ abstract class SettingsStoreBase with Store {
997 final totpSecretKey = await SecureKey.getString(
998 secureStorage: secureStorage,
999 sharedPreferences: sharedPreferences,
1000 - key: SecureKey.useTOTP2FA,
1000 + key: SecureKey.totpSecretKey,
1001 ) ??
1002 '';
1003
@@ -1243,7 +1243,7 @@ abstract class SettingsStoreBase with Store {
1243 totpSecretKey = await SecureKey.getString(
1244 secureStorage: _secureStorage,
1245 sharedPreferences: sharedPreferences,
1246 - key: SecureKey.useTOTP2FA,
1246 + key: SecureKey.totpSecretKey,
1247 ) ??
1248 totpSecretKey;
1249
lib/view_model/set_up_2fa_viewmodel.dart
+3 -1
@@ -27,7 +27,9 @@ abstract class Setup2FAViewModelBase with Store {
27 unhighlightTabs = false,
28 selected2FASettings = ObservableList<VerboseControlSettings>(),
29 state = InitialExecutionState() {
30 - selectCakePreset(selectedCake2FAPreset);
30 + if (selectedCake2FAPreset != Cake2FAPresetsOptions.none) {
31 + selectCakePreset(selectedCake2FAPreset);
32 + }
33 reaction((_) => state, _saveLastAuthTime);
34 }
35