Skip to content

[HOLD for payment 2023-07-26] [$1000] Requesting magic code from 'Magic code' page doesn't clear all sign-in errors #21293

Closed

Description

@kavimuru

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. Navigate to sign-in page
  2. Enter email > click on 'Continue' button
  3. Copy expired magic sign-in link from previous interaction
  4. Paste to browser > prefix the link with 'staging' text > press enter
  5. Verify that 'Magic code expired' page is displayed
  6. Switch to the tab where sign-in page is opened
  7. Click on Sign-in button
  8. Switch to the tab where 'Magic code expired' page is displayed
  9. Click on 'request a new code here!' link
  10. Switch to the tab where sign-in page is opened

Expected Result:

All error messages including 'Please enter your magic code' should be cleared in the same manner as requesting magic code from sign-in page clears all errors

Actual Result:

'Please enter your magic code' error message is not cleared

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.30-5
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

2023-06-15.16.26.26.mp4
Recording.1059.mp4

Expensify/Expensify Issue URL:
Issue reported by: @Natnael-Guchima
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1686836451096149

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~018f0afc70ce23ee77
  • Upwork Job ID: 1671920220866732032
  • Last Price Increase: 2023-07-06

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jun 22, 2023
  2. melvin-bot commented on Jun 22, 2023

    @melvin-bot

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

  3. melvin-bot commented on Jun 22, 2023

    @melvin-bot

    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
  4. mdneyazahmad commented on Jun 22, 2023

    @mdneyazahmad
    Contributor

    Proposal

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

    Request a new magic code does not clear sign in form errors on other tab.

    What is the root cause of that problem?

    When user opens an expired link, and clicks request a new code here!, This calls Session.resendValidateCode(), which clears error field in ONYXKEYS.ACCOUNT key in onyx datastore.

    hasError in BaseValidateCodeForm is based on this, but errorText is dependent based on formError in the component state which is not updated when we request magic code from other component.

    errorText={formError.validateCode ? props.translate(formError.validateCode) : ''}
    hasError={hasError}

    MagicCodeInput just depend on formError prop therefore this error error is not cleared.

    {!_.isEmpty(props.errorText) && (

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

    There are two props related to error field. hasError and errorText. I believe, it should be enough to just rely on hasError to display error message. In fact these two props should be synced, i.e., when hasError is true, errorText should contain an error message, and when it is false, it should be empty.

    These are the changes:

    1. Add extra condition on Line354
    {props.hasError && !_.isEmpty(props.errorText) && ( 
    1. Fix this condition with and
      props.hasError || props.errorText ? styles.borderColorDanger : {},
    props.hasError && props.errorText ? styles.borderColorDanger : {},

    What alternative solutions did you explore? (Optional)

    None

  5. tienifr commented on Jun 22, 2023

    @tienifr
    Contributor

    Proposal

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

    Requesting magic code from 'Magic code' page doesn't clear all sing-in errors

    What is the root cause of that problem?

    We're using component state to show the error

    errorText={formError.twoFactorAuthCode ? props.translate(formError.twoFactorAuthCode) : ''}
    hasError={hasError}

    we just only clear error state when users click Didn't receive a magic code? on login page.

    That why when users click resend validate code from Magic code page, the errors still are shown in the login page.

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

    change function resendValidateCode to

        const resendValidateCode = () => {
            User.resendValidateCode(props.credentials.login, true);
        };
    

    move other code to new function like clearData, then execute this function when props.account.loadingForm === CONST.FORMS.VALIDATE_CODE_FORM

         useEffect(()=>{
            if(props.account.loadingForm === CONST.FORMS.VALIDATE_CODE_FORM){
                clearData()
            }
        },[props.account.loadingForm])
    
    

    Result

    Screen.Recording.2023-06-22.at.17.58.35.mp4
  6. twisterdotcom commented on Jun 22, 2023

    @twisterdotcom
    Contributor

    Chatting in Slack on this one. DIdn't realize this could be done. Let's do it!

  7. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jun 22, 2023
  8. changed the title [-]Requesting magic code from 'Magic code' page doesn't clear all sing-in errors[/-] [+][$1000] Requesting magic code from 'Magic code' page doesn't clear all sing-in errors[/+] on Jun 22, 2023
  9. melvin-bot commented on Jun 22, 2023

    @melvin-bot
  10. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jun 22, 2023
  11. melvin-bot commented on Jun 22, 2023

    @melvin-bot

    Current assignee @twisterdotcom is eligible for the External assigner, not assigning anyone new.

  12. melvin-bot commented on Jun 22, 2023

    @melvin-bot

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

  13. 44 remaining items

  14. melvin-bot commented on Jul 18, 2023

    @melvin-bot

    ⚠️ Looks like this issue was linked to a Deploy Blocker here

    If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

    If a regression has occurred and you are the assigned CM follow the instructions here.

    If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

  15. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on Jul 19, 2023
  16. changed the title [-][$1000] Requesting magic code from 'Magic code' page doesn't clear all sign-in errors[/-] [+][HOLD for payment 2023-07-26] [$1000] Requesting magic code from 'Magic code' page doesn't clear all sign-in errors[/+] on Jul 19, 2023
  17. melvin-bot commented on Jul 19, 2023

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  18. melvin-bot commented on Jul 19, 2023

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.42-26 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2023-07-26. 🎊

    After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

    • External issue reporter
    • Contributor that fixed the issue
    • Contributor+ that helped on the issue and/or PR

    As a reminder, here are the bonuses/penalties that should be applied for any External issue:

    • Merged PR within 3 business days of assignment - 50% bonus
    • Merged PR more than 9 business days after assignment - 50% penalty
  19. twisterdotcom commented on Jul 25, 2023

    @twisterdotcom
    Contributor

    Payment due tomorrow.

    External issue reporter: @Natnael-Guchima due $250: https://www.upwork.com/nx/wm/pre-hire/c/8577561/offer/25751090
    Contributor that fixed the issue: @tienifr due $1000: https://www.upwork.com/nx/wm/workroom/34187190/overview
    Contributor+ that helped on the issue and/or PR: @aimane-chnaif due $1000: https://www.upwork.com/nx/wm/workroom/34202522/overview

  20. twisterdotcom commented on Jul 26, 2023

    @twisterdotcom
    Contributor

    All paid out.

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 productionDailyKSv2ExternalAdded to denote the issue can be worked on by a contributorNewFeatureSomething to build that is a new item.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions