Skip to content

[Due for payment 2026-11-10] [$175] 2FA - After setup 2FA new workspace user is stay in Account option #101848

Closed

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: 9.4.91-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/folder/13176909/test-cases/41237458
Email or phone of affected tester (no customers): utester29+4_270@gmail.com
Issue reported by: Applause Internal Team
Bug source: Regression TC Execution
Device used: Windows 11/ Chrome and Android 12 Chrome
App Component: Workspace Settings

Action Performed:

Precondition:
User A have Xero connection established in the workspace.

Steps:

  1. Login to staging.new.expensify.com
  2. Navigate to workspace settings (User A) where Xero is connected
  3. Click on Members
  4. Click +Invite member
  5. Search for a user that you have access to
  6. Select the user
  7. Invite an user as "Admin"
  8. Login as Invited admin member
  9. Verify a 2FA required page is shown
  10. Press the enable button
  11. Validate the account
  12. Complete the 2FA flow
  13. Click "Got it" Button

Expected Result:

Web / Desktop Verify you land in Home tab

Actual Result:

User is staying in Account/ Security option

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome Safari

Screenshots/Videos

Bug7264958_1789960664260.issue_2FA_workspace_member.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Julia Ponikarchuk
Bug ID: 7264958

Issue OwnerCurrent Issue Owner: @Krishna2323
Upwork Automation - Do Not Edit

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Sep 22, 2026
  2. applause-bot commented on Sep 22, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/29f354f2d0d3a9c452a85bf55ddbe3a4216f249e7c98c15e1add8eab2d696195

  3. changed the title [-][26W38] - [2FA] - After setup 2FA new workspace user is stay in Account option[/-] [+]2FA - After setup 2FA new workspace user is stay in Account option[/+] on Sep 22, 2026
  4. MelvinBot commented on Sep 22, 2026

    @MelvinBot
    Contributor

    Updated 2026-09-28: Revised based on feedback from Krishna2323.

    Proposal

    What is the root cause of that problem?

    The required-2FA overlay starts 2FA setup with Settings > Security as the base route. When the user presses Got it, the success page can't tell a forced entry from a voluntary one.

    In DynamicSuccessPage.tsx:96-116, Got it has three outcomes:

    1. Forced 2FA during onboarding: dismiss to Home and resume onboarding.
    2. Settings > Security base: stay in the RHP on the "2FA enabled" page.
    3. Anything else: goBack() to the base route.

    An invited admin who has already finished onboarding fails branch 1, because isForced2FAOnboardingSetup requires incomplete onboarding. Branch 2 then wins because the overlay passed ROUTES.SETTINGS_SECURITY (RequireTwoFactorAuthenticationOverlay.tsx:93-96). The admin is left on Account > Security, which is the reported Actual Result.

    What changes do you think we should make in order to solve the problem?

    Use the base route as the forced-entry signal.

    1. In RequireTwoFactorAuthenticationOverlay, pass ROUTES.HOME as the base route instead of ROUTES.SETTINGS_SECURITY. The overlay is the only caller that uses a Home base. Settings > Security, the USD bank account flow, and the Xero flow all use their own active route.
    2. In DynamicSuccessPage, add isRequired2FAOverlayFlow = focusedRoute?.name === SCREENS.HOME. Gate the onboarding handoff on (isSecuritySettingsFlow || isRequired2FAOverlayFlow) && isForcedOnboardingHandoff. Update the comment above it, which says forced setup always enters from Security.
    3. Leave the isSecuritySettingsFlow branch as it is, so only the voluntary entry stays on the Enabled page (from Fix: keep 2FA RHP open on Enabled page after Got it from Security settings).

    Result:

    • Forced entry, onboarding complete: falls through to goBack(), which calls quitAndNavigateBack('home') and lands on Home.
    • Forced entry, onboarding incomplete: runs the existing handoff, which calls openApp() and resumes onboarding at the saved step.
    • Voluntary Settings > Security entry: stays on the Enabled page.
    • USD bank account and Xero flows: unchanged. Their base is neither Home nor Security, so they never enter the onboarding handoff.

    What specific scenarios should we cover in automated tests?

    Add tests/unit/pages/settings/Security/TwoFactorAuth/DynamicSuccessPageTest.tsx. Mock SuccessPageBase to capture onButtonPress, mock useDynamicBackPath, and mock Navigation. No test covers this page today.

    1. Forced entry + onboarding complete: base home, hasCompletedGuidedSetupFlow: true. Expect goBack('home'), and expect no call to navigate(SETTINGS_2FA_ENABLED) or resumeOnboardingAfterRequired2FASetup.
    2. Forced entry + onboarding incomplete: base home, twoFactorAuthSetupInProgress: true, hasCompletedGuidedSetupFlow: false. Expect revealRouteBeforeDismissingModal(ROUTES.HOME) followed by resumeOnboardingAfterRequired2FASetup.
    3. Voluntary Settings > Security entry: base settings/security, onboarding complete. Expect navigate(ROUTES.SETTINGS_2FA_ENABLED, {forceReplace: true}) and clearTwoFactorAuthData(true).

    What alternative solutions did you explore? (Optional)

    Alternatives considered
    • New Onyx flag (isForcedTwoFactorAuthSetup). Rejected: it adds global state that must be cleared by hand. The base route already carries the signal.
    • Drop the base-route check and gate the handoff on isForcedOnboardingHandoff alone. Rejected: USD bank account and Xero 2FA setups by users with incomplete onboarding would be pulled into the onboarding handoff.
    • Read account.needsTwoFactorAuthSetup at Got it time. Rejected: the openApp response after enabling 2FA overwrites it, so the check is racy.
    Risk review
    • Required 2FA setup screen is unresponsive, blocking new-domain login and account merge doesn't depend on the Security base. Before that PR, the overlay passed no base, so the route was built on the onboarding screen behind the overlay. The linked issue picked Security only as a "stable, always-resolvable base". Home was never compared. The onboarding guard's 2FA exception checks account state and the focused 2FA screen name, not the base route (OnboardingGuard.ts:125-130). So the Enable button still opens the wizard with a Home base.
    • Only DynamicSuccessPage reads the base. That dependency is real: validateTwoFactorAuth defers openApp() until the handoff on Got it (Session/index.ts:1487-1514). Step 2 keeps that handoff running for the Home base.
    • Small edge case: useDynamicBackPath returns ROUTES.HOME if the navigation state isn't ready (useDynamicBackPath.ts:33-35). The success page mounts only after navigation is ready, so the risk is low.

    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/101848#issuecomment-5771800818) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.

  5. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Sep 22, 2026
  6. melvin-bot commented on Sep 22, 2026

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @Krishna2323 (External)

  7. melvin-bot commented on Sep 22, 2026

    @melvin-bot

    Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.

  8. melvin-bot commented on Sep 25, 2026

    @melvin-bot

    @Krishna2323 Whoops! This issue is 2 days overdue. Let's get this updated quick!

  9. ashusatyarthi-wq commented on Sep 26, 2026

    @ashusatyarthi-wq

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    When an invited admin logs in to an account where a workspace requires 2FA (e.g. Xero connected), the "2FA is required" overlay blocks the screen. After clicking "Enable", validating the account, and completing the 2FA flow, clicking the "Got it" button leaves the user stuck on the Account / Security settings page instead of redirecting them to the Home tab / Workspace.


    What is the root cause of that problem?

    In RequireTwoFactorAuthenticationOverlay.tsx:93-96, the overlay's "Enable" button explicitly hardcodes ROUTES.SETTINGS_SECURITY as the base path:

    const handleOnPress = () => {
        snapshotOnboardingResumePathIfNeeded();
        Navigation.navigate(getTwoFactorAuthRoute(ROUTES.SETTINGS_SECURITY, {forceSetup: true}));
    };

    This creates dynamic 2FA setup routes with backTo = ROUTES.SETTINGS_SECURITY.

    When 2FA setup completes and the user reaches DynamicSuccessPage.tsx:

    1. useDynamicBackPath resolves to settings/security, making focusedRoute?.name === SCREENS.SETTINGS.SECURITY (isSecuritySettingsFlow = true).
    2. For an existing user who has already completed guided setup (or whose onboarding is complete), hasCompletedGuidedSetupFlow is true, so isForcedOnboardingHandoff evaluates to false.
    3. Consequently, at DynamicSuccessPage.tsx:108-115:
    if (isSecuritySettingsFlow) {
        Navigation.navigate(ROUTES.SETTINGS_2FA_ENABLED, {forceReplace: true});
        clearTwoFactorAuthData(true);
        return;
    }

    The app assumes the user entered voluntarily from Settings > Security to view their security settings, and keeps the modal open on SETTINGS_2FA_ENABLED over Account > Security. Because the overlay forced the entry using ROUTES.SETTINGS_SECURITY, the app cannot differentiate a forced 2FA entry from an intentional voluntary visit to Security Settings.


    What changes do you think we should make in order to solve the problem?

    1. Pass ROUTES.HOME as the base route in RequireTwoFactorAuthenticationOverlay.tsx

    The required 2FA overlay intercepts the user on Home / Workspace, not inside Security Settings. The base return destination for the forced flow should be ROUTES.HOME:

         const handleOnPress = () => {
             snapshotOnboardingResumePathIfNeeded();
    -        Navigation.navigate(getTwoFactorAuthRoute(ROUTES.SETTINGS_SECURITY, {forceSetup: true}));
    +        Navigation.navigate(getTwoFactorAuthRoute(ROUTES.HOME, {forceSetup: true}));
         };

    2. Ensure onboarding handoff in DynamicSuccessPage.tsx handles both base routes

    In DynamicSuccessPage.tsx:
    Update the check for forced onboarding handoff so that users who still need to complete onboarding resume onboarding whether the route originated from HOME or SETTINGS_SECURITY:

    -    const shouldReturnToOnboardingAfter2FA = isSecuritySettingsFlow && isForcedOnboardingHandoff;
    +    const shouldReturnToOnboardingAfter2FA = isForcedOnboardingHandoff;

    When onButtonPress runs:

    • If onboarding is incomplete (shouldReturnToOnboardingAfter2FA is true), completeForcedOnboarding2FAHandoff() dismisses to Home and resumes onboarding.
    • If the user entered voluntarily from Settings > Security (isSecuritySettingsFlow is true), they stay on the SETTINGS_2FA_ENABLED screen in the RHP (preserving PR Fix: keep 2FA RHP open on Enabled page after Got it from Security settings #92637).
    • If the user entered via the required overlay (dynamicBackPath === ROUTES.HOME), goBack() executes quitAndNavigateBack(dynamicBackPath), cleanly dismissing the modal and landing the user on the Home tab.

    What specific scenarios should be covered in tests?

    Add unit tests in tests/unit/TwoFactorAuthFlowTest.ts:

    1. Forced 2FA overlay entry (onboarding complete):
      • User triggers 2FA from RequireTwoFactorAuthenticationOverlay.
      • Complete 2FA and press "Got it".
      • Assert Navigation.navigate / quitAndNavigateBack redirects to ROUTES.HOME, NOT SETTINGS_2FA_ENABLED.
    2. Voluntary 2FA entry from Security Settings:
      • User navigates to Settings > Security > Two-Factor Authentication.
      • Complete 2FA and press "Got it".
      • Assert user remains in RHP on SETTINGS_2FA_ENABLED.
    3. Forced 2FA overlay entry (onboarding incomplete):
      • User with incomplete guided setup completes 2FA from overlay.
      • Assert completeForcedOnboarding2FAHandoff fires and resumes onboarding.

    What alternative solutions did you explore? (Optional)

    1. Setting a persistent Onyx flag (e.g. isForcedTwoFactorAuthSetup):
      • Adds state to the global store that must be manually cleared. Pointing the overlay's dynamic route directly to ROUTES.HOME is stateless, self-cleaning, and uses the existing dynamicBackPath routing architecture.
  10. Krishna2323 commented on Sep 27, 2026

    @Krishna2323
    Contributor

    @MelvinBot, your root cause looks right to me, but I'd rather not add a new Onyx flag. The base route can already tell the forced entry apart. Please look into this approach instead:

    1. In RequireTwoFactorAuthenticationOverlay.tsx, pass ROUTES.HOME as the base route instead of ROUTES.SETTINGS_SECURITY.
    2. In DynamicSuccessPage.tsx, add isRequired2FAOverlayFlow = focusedRoute?.name === SCREENS.HOME and gate the handoff on (isSecuritySettingsFlow || isRequired2FAOverlayFlow) && isForcedOnboardingHandoff.

    Onboarded admins should then fall through to goBack() and land on Home, while the voluntary Settings > Security flow keeps its stay-in-RHP behavior from #92637. Please don't drop the base-route check entirely, since that would pull the USD bank account and Xero 2FA flows into the onboarding handoff for users who haven't finished onboarding.

    Please also confirm:

    If this holds up, please update the proposal and cover these cases in tests:

    • Forced entry + onboarding complete → lands on Home
    • Forced entry + onboarding incomplete → resumes onboarding
    • Voluntary Settings > Security entry → stays on the Enabled page
  11. 35 remaining items

  12. melvin-bot commented on Nov 9, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  13. melvin-bot commented on Nov 9, 2026

    @melvin-bot

    Payment Summary

    Resolving PRs:

    BugZero Checklist (@mallenexpensify)

    • I have confirmed assignees, roles, and Upwork contracts look correct
    • I have paid out Upwork contracts / manual NewDot requests
    • [BugZero Assignee] I have created a GH issue for creating/updating the regression test once above steps have been agreed upon
  14. melvin-bot commented on Nov 12, 2026

    @melvin-bot

    @mallenexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  15. mallenexpensify commented on Nov 13, 2026

    @mallenexpensify
    Contributor

    Claude posting on behalf of Matt:

    Waiting on C+ checklist from @Krishna2323.

    Job price: $175 (standard, no Help Wanted, assigned 2026-09-22). Krishna2323 (C+): 100% once the checklist is in, via NewDot.

    No deploy blockers or regressions on the issue or the PR.

    Evidence
    • Resolving PR: #102482 by MelvinBot, merged 2026-11-02, approved by Krishna2323, MonilBhavsar. No revert.
    • TestRail case: none yet
    • Test videos: C+ 5/5.

    PAYPREP v1

  16. mallenexpensify commented on Nov 13, 2026

    @mallenexpensify
    Contributor

    @Krishna2323 plz complete the Contributor+ checklist and tag me in a post once you have. Thx

  17. mallenexpensify commented on Nov 13, 2026

    @mallenexpensify
  18. Krishna2323 commented on Nov 13, 2026

    @Krishna2323
    Contributor

    Contributor+ Checklist:

    Regression Test Proposal

    Precondition:

    • Account A owns a workspace with Xero connected.
    • Account B has finished onboarding and has 2FA disabled.

    Test:

    1. As Account A, go to the workspace Members page and invite Account B as an Admin.
    2. Log in as Account B.
    3. On the Two-factor authentication required screen, click Enable.
    4. Complete the 2FA setup (validate the account if asked, copy the codes, enter the 6-digit code).
    5. On the Two-factor authentication enabled page, click Got it.
    6. Verify that the 2FA modal closes and the user lands on Home, not on Account > Security.

    Do we agree 👍 or 👎

  19. Krishna2323 commented on Nov 13, 2026

    @Krishna2323
    Contributor

    @mallenexpensify checklist completed ^

  20. mallenexpensify commented on Nov 15, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @Krishna2323 due $175 via NewDot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions