From 53723b5009fb3b4225be4055cf9d280f1a0d6f85 Mon Sep 17 00:00:00 2001 From: Oscar Franco Date: Thu, 21 Sep 2023 14:30:38 +0200 Subject: [PATCH 1/2] Add currentStep to navigation hook to prevent lock in certain state --- .../settings/Security/TwoFactorAuth/TwoFactorAuthSteps.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/settings/Security/TwoFactorAuth/TwoFactorAuthSteps.js b/src/pages/settings/Security/TwoFactorAuth/TwoFactorAuthSteps.js index e0094267742b..3e263f6f14aa 100644 --- a/src/pages/settings/Security/TwoFactorAuth/TwoFactorAuthSteps.js +++ b/src/pages/settings/Security/TwoFactorAuth/TwoFactorAuthSteps.js @@ -24,6 +24,7 @@ function TwoFactorAuthSteps({account = defaultAccount}) { setCurrentStep(account.twoFactorAuthStep); return; } + if (account.requiresTwoFactorAuth) { setCurrentStep(CONST.TWO_FACTOR_AUTH_STEPS.ENABLED); } else { @@ -31,7 +32,7 @@ function TwoFactorAuthSteps({account = defaultAccount}) { } // we don't want to trigger the hook every time the step changes, only when the requiresTwoFactorAuth changes // eslint-disable-next-line react-hooks/exhaustive-deps - }, [account.requiresTwoFactorAuth]); + }, [account.requiresTwoFactorAuth, account.twoFactorAuthStep]); const handleSetStep = useCallback( (step, animationDirection = CONST.ANIMATION_DIRECTION.IN) => { From 56aeedb15a814143aac5e728be85c15f0ba98aca Mon Sep 17 00:00:00 2001 From: Oscar Franco Date: Thu, 21 Sep 2023 14:46:52 +0200 Subject: [PATCH 2/2] Remove comment because without the 2fa step it doesn't work --- src/pages/settings/Security/TwoFactorAuth/TwoFactorAuthSteps.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/pages/settings/Security/TwoFactorAuth/TwoFactorAuthSteps.js b/src/pages/settings/Security/TwoFactorAuth/TwoFactorAuthSteps.js index 3e263f6f14aa..58852c1dba02 100644 --- a/src/pages/settings/Security/TwoFactorAuth/TwoFactorAuthSteps.js +++ b/src/pages/settings/Security/TwoFactorAuth/TwoFactorAuthSteps.js @@ -30,8 +30,6 @@ function TwoFactorAuthSteps({account = defaultAccount}) { } else { setCurrentStep(CONST.TWO_FACTOR_AUTH_STEPS.CODES); } - // we don't want to trigger the hook every time the step changes, only when the requiresTwoFactorAuth changes - // eslint-disable-next-line react-hooks/exhaustive-deps }, [account.requiresTwoFactorAuth, account.twoFactorAuthStep]); const handleSetStep = useCallback(