Repository navigation
Send users Home after required 2FA setup instead of Settings > Security - #102482
Conversation
Co-authored-by: Krishna <Krishna2323@users.noreply.github.com>
|
🤖 Android test steps verification results: I couldn't run any of the steps, so nothing was verified. The blockers are in the test environment, not in the app. The PR's Tests section is still a TODO, so I used the repro steps from 2FA - After setup 2FA new workspace user is stay in Account option. Steps 1–4 need a second account that owns a Xero-connected workspace and invites the test user as Admin. Step 5 needs an emailed validation code, and I can't read that inbox. |
|
🤖 Web test steps verification results: ❌ fail I couldn't run any of the steps, so nothing was verified. The blockers are in the test environment, not in the app. The PR's Tests section is still a TODO, so I used the repro steps from 2FA - After setup 2FA new workspace user is stay in Account option. Steps 1–4 need a second account that owns a Xero-connected workspace and invites the test user as Admin. Step 5 needs an emailed validation code, and I can't read that inbox. |
|
@MelvinBot merge main |
…ItLandsOnHome Co-authored-by: Krishna <Krishna2323@users.noreply.github.com>
| const isIncompleteOnboarding = hasCompletedGuidedSetupFlow === false; | ||
| const hasSavedOnboardingPath = !!onboardingInitialPath?.includes(`/${ROUTES.ONBOARDING_ROOT.route}`); | ||
| // Forced onboarding 2FA always enters via Settings > Security (from the require-2FA overlay). | ||
| // Forced onboarding 2FA enters from the require-2FA overlay (Home base); users can also reach it from Settings > Security. |
There was a problem hiding this comment.
@MelvinBot please reword the comment to avoid the semicolon (CONSISTENCY-15).
There was a problem hiding this comment.
Done in 06ae2c5. I split the comment into two sentences and replaced the "(Home base)" parenthetical:
// Forced onboarding 2FA enters from the require-2FA overlay, which uses Home as its base route. Users can also reach it from Settings > Security.Line 62 of the comment block below also has a semicolon. I left it alone because that line isn't part of this PR's diff. Let me know if you want me to reword it too.
Co-authored-by: Krishna <Krishna2323@users.noreply.github.com>
|
@MelvinBot update the testing steps to: And also mark all the author checklist boxes as done. I don't care about the recordings, I have them and will add them to the reviewer checklist, so mark that one as done in the author checklist too. |
|
I updated the PR description:
The Screenshots/Videos section is still empty, because you said you'll add your recordings to the reviewer checklist. |
|
@MelvinBot mark this PR ready for review |
|
I couldn't mark this PR ready for review. My run isn't allowed to change a PR's draft state, so the PR is still a draft. To mark it ready, click Ready for review at the bottom of the PR page. |
|
@MelvinBot mark this PR ready for review |
|
I couldn't mark this PR ready for review. My environment blocked the Krishna2323, you can do it yourself: click Ready for review at the bottom of the PR page. |
|
@Krishna2323 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppandroid_hybrid.mp4Android: mWeb Chromeandroid_mWeb.mp4iOS: HybridAppios_hybrid.mp4iOS: mWeb Safariios_mWeb.mp4MacOS: Chrome / Safariweb_chrome.mp4 |
|
@MelvinBot please update the PR description to mention the new |
|
I updated the PR description.
QA Steps still say "Same as tests", so QA covers the new steps too. |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppandroid_hybrid.mp4Android: mWeb Chromeandroid_mWeb.mp4iOS: HybridAppios_hybrid.mp4iOS: mWeb Safariios_mWeb.mp4MacOS: Chrome / Safariweb_chrome.mp4 |
|
@trjExpensify Could you please review the recordings in the checklist and confirm that everything looks good now? |
MonilBhavsar
left a comment
There was a problem hiding this comment.
There are conflicts
|
@MelvinBot resolve conflicts |
…ItLandsOnHome Co-authored-by: Krishna <Krishna2323@users.noreply.github.com> # Conflicts: # src/pages/settings/Security/TwoFactorAuth/DisabledPage.tsx # src/pages/settings/Security/TwoFactorAuth/SuccessPage.tsx # src/pages/settings/Security/TwoFactorAuth/TwoFactorAuthWrapper.tsx
|
Resolved the conflicts by merging
I could not run typecheck or Jest in this environment, so CI will be the first check. |
|
@MonilBhavsar conflicts resolved |
|
thanks! |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 MonilBhavsar has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/MonilBhavsar in version: 9.5.28-4 🚀
|
|
No help site update needed. This is a navigation fix: after required 2FA setup, users now land on Home instead of staying on Account > Security. No help article describes where users land after this setup. |
|
🚀 Deployed to staging by https://github.com/MonilBhavsar in version: 9.5.30-0 🚀
|
|
🚀 Deployed to production by https://github.com/blimpich in version: 9.5.30-0 🚀
Bundle Size Analysis (Sentry): |





Explanation of Change
When a workspace requires 2FA, the require-2FA overlay opens the 2FA setup with Settings > Security as its base route. On the success page, Got it keeps users who came from Settings > Security on the "2FA enabled" page. An invited admin who had already finished onboarding therefore stayed on Account > Security instead of landing on Home.
This PR keeps Settings > Security behind the 2FA modal during forced setup, because Home doesn't load properly until 2FA is enabled. It sends the user Home when they leave the success page.
ROUTES.SETTINGS_SECURITYnow has a{route, getRoute}shape.getRoute(true)returnssettings/security?forceSetup=true. Existing callers usegetRoute(), so their URL doesn't change.settings/security?forceSetup=true. Base-route query params persist through every 2FA step and are merged into the success screen's params. They also survive the Onyx clear invalidateTwoFactorAuth, so the page doesn't depend on account flags.DynamicSuccessPagereadsforceSetupfrom its route params. For a forced setup, both Got it and the back button reveal Home under the RHP withNavigation.revealRouteBeforeDismissingModal(ROUTES.HOME)and clear the 2FA data inafterTransition.Unchanged:
forceSetupparam, so it still ends on the "2FA enabled" page.Automated tests:
DynamicSuccessPageTestcovers the forced entry (onboarding complete and incomplete, plus the back button) and the voluntary Settings > Security entry.twoFactorAuthForceSetupDynamicRouteTestresolves each 2FA step URL (setup, verify, success) built onROUTES.SETTINGS_SECURITY.getRoute(true). It checks thatforceSetupreaches the params of every step, that the forced success screen's back path still resolves to Settings > Security, and that voluntary setup fromgetRoute()has noforceSetupparam.Fixed Issues
$ #101848
PROPOSAL: #101848 (comment)
Tests
Precondition: Account A owns a workspace that requires 2FA (e.g. Xero connected). Account B already finished onboarding and has 2FA disabled.
Every
ROUTES.SETTINGS_SECURITYcaller changed, so also verify these still go back to Account > Security:Offline tests
QA Steps
Same as tests.
Verify that no errors appear in the JS console
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari