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

Validate an unvalidated account when they enter a magic code in the "Let's make sure it's you" prompt #55313

Open
8 tasks done
trjExpensify opened this issue Jan 15, 2025 · 5 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Internal Requires API changes or must be handled by Expensify staff

Comments

@trjExpensify
Copy link
Contributor

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


Version Number: v9.0.85-4
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A
If this was caught during regression testing, add the test name, ID and link from TestRail: No
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @trjExpensify
Slack conversation: #convert

Action Performed:

  1. Create a new account on new.expensify.com
  2. Go to Settings > Security > Add copilot
  3. Enter the magic code sent.

Expected Result:

Entering a magic code (successfully) should validate an unvalidated account

Actual Result:

The magic code is not accepted because the account isn't validated.

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?
Yes, go to Settings > profile > contact method and validate the primaryLogin. Then, try again.

Platforms:

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

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Image

View all open jobs on GitHub

@trjExpensify trjExpensify added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Internal Requires API changes or must be handled by Expensify staff labels Jan 15, 2025
Copy link

melvin-bot bot commented Jan 15, 2025

Triggered auto assignment to @Christinadobrzyn (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

Copy link
Contributor

⚠️ Thanks for your proposal. Please update it to follow the proposal template, as proposals are only reviewed if they follow that format.

Copy link
Contributor

⚠️ Thanks for your proposal. Please update it to follow the proposal template, as proposals are only reviewed if they follow that format.

@Shahidullah-Muffakir
Copy link
Contributor

Proposal

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

When an unvalidated user tries to add a copilot through the Security settings, they receive a magic code. However, this code can only be used for adding a copilot - it can't validate their account. Instead, users must separately go to Profile > Contacts to validate their account first.

What is the root cause of that problem?

The root case is the we are not checking the validation of the primary login before sending magic for adding a copilot

handleSubmitForm={(validateCode) => Delegate.addDelegate(login, role, validateCode)}

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

When an unvalidated user clicks the "Add copilot" button, we should redirect them to the "This feature requires you to validate your account" modal. This is the same behavior users see when trying to add a payment method without validation.
in the

onPress={() => setIsValidateCodeActionModalVisible(true)}

    onPress={() => (isUserValidated ? setIsValidateCodeActionModalVisible(true) : Navigation.navigate(ROUTES.SETTINGS_WALLET_VERIFY_ACCOUNT.getRoute()))}

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

What alternative solutions did you explore? (Optional)

Alternative 1:

In the ConfirmDelegatePage page check if user is not validated, then redirect it to the Contact method validation page,

onPress={() => setIsValidateCodeActionModalVisible(true)}

as:

onPress={() => account?.validated  ? setIsValidateCodeActionModalVisible(true): Navigation.navigate(ROUTES.SETTINGS_CONTACT_METHOD_DETAILS.getRoute(account.primaryLogin))}

Alternative 2:
We should update the logic in the handleSubmitForm and sendValidateCode functions to account for the validation status of the account. Specifically, the logic should check if the account is validated before proceeding to delegate actions.

handleSubmitForm={(validateCode) => Delegate.addDelegate(login, role, validateCode)}

  1. Replace the current sendValidateCode function with:
sendValidateCode={() => {
    return account?.validated ? User.requestValidateCodeAction() : 
    User.requestContactMethodValidateCode(account?.primaryLogin ?? '');
}}
  1. Update the handleSubmitForm function with:
handleSubmitForm={(validateCode) => {
    return account?.validated ? Delegate.addDelegate(login, role, validateCode) : 
    User.validateSecondaryLogin(loginList, account?.primaryLogin, validateCode);
}}
  1. and validatePendingAction={account?.validated ? null : loginData.pendingFields?.validateCodeSent}

Recording of main solution

Screen.20Recording.202025-01-16.20at.206.mp4

@allgandalf
Copy link
Contributor

This should be handled in the BE

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. Daily KSv2 Internal Requires API changes or must be handled by Expensify staff
Projects
Development

No branches or pull requests

5 participants