Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Hold App#20404] 2 factor authentiaction code dissappear when switch to small screen #20611

Closed
1 of 6 tasks
kavimuru opened this issue Jun 12, 2023 · 19 comments
Closed
1 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Weekly KSv2

Comments

@kavimuru
Copy link

kavimuru commented Jun 12, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. Go to Setting--> Security --> Two factor authentication
  2. Observe Recovery codes appear
  3. Resize the window to mobile view

Expected Result:

Recovery codes still display

Actual Result:

Recovery codes disappear

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.26-1
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation

Screen.Recording.2023-06-07.at.15.42.20.mov
Recording.946.mp4

Expensify/Expensify Issue URL:
Issue reported by: @dukenv0307
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1686127296080609

View all open jobs on GitHub

@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jun 12, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 12, 2023

Triggered auto assignment to @MitchExpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Jun 12, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@kavimuru
Copy link
Author

Proposal

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

Two factor auth code disappear when change the screen size

What is the root cause of that problem?

When users press Two factor authentication in Security page, we call API EnableTwoFactorAuth to fetch recoveryCodes and show it in TwoFactorAuthentication page.
In this page, if users change the screen size from large to small, the modal will be unmounted then mounted again, that make this function is called

TwoFactorAuthActions.clearTwoFactorAuthData();

So we clear recoveryCodes without the logic to fetch it again

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

We should move this function Session.toggleTwoFactorAuth(true); from SecuritySettingsPage to below this line


like what DisablePage component did with Session.toggleTwoFactorAuth(false);
So when the component is mounted, we can fetch recoveryCodes again

@kushu7
Copy link
Contributor

kushu7 commented Jun 12, 2023

Related to :
#20404
#20522

@roryabraham
Copy link
Contributor

Thanks for flagging that @kushu7. Let's put this on HOLD for #20404

@roryabraham roryabraham changed the title 2 factor authentiaction code dissappear when switch to small screen [HOLD] 2 factor authentiaction code dissappear when switch to small screen Jun 12, 2023
@MitchExpensify MitchExpensify added Weekly KSv2 and removed Daily KSv2 labels Jun 13, 2023
@MitchExpensify
Copy link
Contributor

Switching to weekly while on hold 👍

@melvin-bot melvin-bot bot added the Overdue label Jun 21, 2023
@MitchExpensify
Copy link
Contributor

On hold

@esh-g
Copy link
Contributor

esh-g commented Jun 28, 2023

Coming from a duplicate issue of this: #21803

Proposal

Please re-state the problem

Recovery codes are cleared on resize.

What is the root cause of that problem?

When we resize the page, the whole screen gets remounted (a feature of the new architecture).

useEffect(() => {
return () => {
TwoFactorAuthActions.clearTwoFactorAuthData();
};
}, []);

And due to the above code, when the component unmounts, it clears the codes.

What changes do you think we should make to solve this problem?

Instead of clearing the codes on unmount, we can clear them when the navigation shifts focus from the screen. This way we can clear the codes when the user is not seeing them and also prevent this issue.
This can be done by first adding the withNavigationFocus HOC to CodePage.js. And then we can refactor the useEffect to clear the codes when navigation focus shifts. Like this:

useEffect(() => {
    if (props.isFocused) {
        return;
    }
    TwoFactorAuthActions.clearTwoFactorAuthData();
}, [props.isFocused]);

What other approach did you explore?

None

@melvin-bot
Copy link

melvin-bot bot commented Jun 28, 2023

Looks like something related to react-navigation may have been mentioned in this issue discussion.

As a reminder, please make sure that all proposals are not workarounds and that any and all attempt to fix the issue holistically have been made before proceeding with a solution. Proposals to change our DeprecatedCustomActions.js files should not be accepted.

Feel free to drop a note in #expensify-open-source with any questions.

@nitin-kukreti
Copy link

I think this is a dupe of #20611 #21407

@MitchExpensify
Copy link
Contributor

Still on hold for #20404 but progress is being made there!

@melvin-bot melvin-bot bot removed the Overdue label Jun 30, 2023
@mountiny mountiny changed the title [HOLD] 2 factor authentiaction code dissappear when switch to small screen [Hold App#20404] 2 factor authentiaction code dissappear when switch to small screen Jul 6, 2023
@melvin-bot melvin-bot bot added the Overdue label Jul 10, 2023
@MitchExpensify
Copy link
Contributor

Still on hold but PRs are being drafted in the related issue! 🚀 #20404

@melvin-bot melvin-bot bot removed the Overdue label Jul 11, 2023
@melvin-bot melvin-bot bot added the Overdue label Jul 19, 2023
@MitchExpensify
Copy link
Contributor

@mountiny curious for a fresh take on this as its been on hold for #20404 for a while. Does that hold still make sense in your opinion?

@melvin-bot melvin-bot bot removed the Overdue label Jul 25, 2023
@mountiny
Copy link
Contributor

It does, that PR should resolve this issue 🤝

@MitchExpensify
Copy link
Contributor

🤝

@melvin-bot melvin-bot bot added the Overdue label Aug 3, 2023
@MitchExpensify
Copy link
Contributor

Still on hold for #20404

@melvin-bot melvin-bot bot removed the Overdue label Aug 9, 2023
@melvin-bot melvin-bot bot added the Overdue label Aug 21, 2023
@MitchExpensify
Copy link
Contributor

Still on hold for #20404

Same

@melvin-bot melvin-bot bot removed the Overdue label Aug 21, 2023
@melvin-bot melvin-bot bot added the Overdue label Aug 30, 2023
@MitchExpensify
Copy link
Contributor

Still on hold for #20404

Same

@melvin-bot melvin-bot bot removed the Overdue label Aug 30, 2023
@melvin-bot melvin-bot bot added the Overdue label Sep 11, 2023
@MitchExpensify
Copy link
Contributor

Whoop! This was resolved in #20404

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Weekly KSv2
Projects
None yet
Development

No branches or pull requests

7 participants