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

[User Settings] Allow users to add secondary logins #2169

Merged
merged 14 commits into from
Apr 6, 2021

Conversation

Maftalion
Copy link
Contributor

@Maftalion Maftalion commented Mar 31, 2021

Details

  • Updates to the profile page to handle adding/verifying a secondary login
  • New page created for adding a new email/phone login

Fixed Issues

Fixes #2029

Tests

For a user without a secondary login:

  • Go to the Profile page, click Add, enter the phone/email & password on the form
  • Test that button is disabled until form is correctly filled and errors are shown for invalid entries
  • If the login exists but is unverified, confirm that clicking the "Resend" button resends the verification code
  • If the login is verified then it just appears in plain-text

To test specific scenarios, you can also stub the data in getLogins:

Unverified phone: [{ "partnerName": "expensify.com", "partnerUserID": "[email protected]", "validatedDate": "" }, { "partnerName": "expensify.com", "partnerUserID": "[email protected]", "validatedDate": "2021-02-22 03:54:15" }]

Unverified email: [{ "partnerName": "expensify.com", "partnerUserID": "[email protected]", "validatedDate": "2021-02-22 03:54:15" }, { "partnerName": "expensify.com", "partnerUserID": "[email protected]", "validatedDate": "" }]

Multiple phone (verified): [{ "partnerName": "expensify.com", "partnerUserID": "[email protected]", "validatedDate": "" }, { "partnerName": "expensify.com", "partnerUserID": "[email protected]", "validatedDate": "2021-02-22 03:54:15" }, { "partnerName": "expensify.com", "partnerUserID": "[email protected]", "validatedDate": "2021-02-22 03:54:15" }]

No Phone: [{ "partnerName": "expensify.com", "partnerUserID": "[email protected]", "validatedDate": "2021-02-22 03:54:15" }]

No Email: [{ "partnerName": "expensify.com", "partnerUserID": "[email protected]", "validatedDate": "2021-02-22 03:54:15" }]

QA Steps

same as above

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web

Screen Shot 2021-03-31 at 1 48 18 AM
Screen Shot 2021-03-31 at 1 48 30 AM
Screen Shot 2021-03-31 at 1 48 42 AM
Screen Shot 2021-03-31 at 1 48 54 AM
Screen Shot 2021-03-31 at 1 49 07 AM

Mobile Web Screen Shot 2021-03-31 at 1 49 31 AM Screen Shot 2021-03-31 at 1 49 47 AM Screen Shot 2021-03-31 at 1 49 59 AM Screen Shot 2021-03-31 at 1 50 30 AM Screen Shot 2021-03-31 at 1 50 45 AM
Desktop Screen Shot 2021-03-31 at 1 46 09 AM Screen Shot 2021-03-31 at 1 46 21 AM Screen Shot 2021-03-31 at 1 46 33 AM Screen Shot 2021-03-31 at 1 46 56 AM Screen Shot 2021-03-31 at 1 47 20 AM
iOS Screen Shot 2021-03-31 at 1 44 14 AM Screen Shot 2021-03-31 at 1 44 31 AM Screen Shot 2021-03-31 at 1 44 46 AM Screen Shot 2021-03-31 at 1 45 17 AM Screen Shot 2021-03-31 at 1 45 44 AM
Android Screen Shot 2021-03-31 at 1 53 15 AM Screen Shot 2021-03-31 at 1 53 30 AM Screen Shot 2021-03-31 at 1 53 38 AM Screen Shot 2021-03-31 at 1 53 45 AM Screen Shot 2021-03-31 at 1 53 55 AM

@Maftalion Maftalion requested a review from a team as a code owner March 31, 2021 02:58
@MelvinBot MelvinBot requested review from timszot and removed request for a team March 31, 2021 02:59
Copy link
Contributor

@NikkiWines NikkiWines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a couple of comments but overall this is really shaping up 🚀

src/libs/actions/User.js Outdated Show resolved Hide resolved
src/pages/settings/AddLoginPage.js Outdated Show resolved Hide resolved
src/pages/settings/AddLoginPage.js Outdated Show resolved Hide resolved
src/pages/settings/ProfilePage/index.js Show resolved Hide resolved
src/pages/settings/ProfilePage/index.js Outdated Show resolved Hide resolved
src/pages/settings/ProfilePage/LoginField.js Outdated Show resolved Hide resolved
src/pages/settings/ProfilePage/LoginField.js Outdated Show resolved Hide resolved
Copy link
Contributor

@NikkiWines NikkiWines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking super good.

I just realized we're routing users to e.com (through the validation link) instead of to e.cash, which is a little unfortunate. That'll require some changes outside of the E.cash repository to resolve. We'll likely want to pass something like isFromExpensifyCash in setSecondaryLogin and resendValidateCode. I'll take a look at that implementation today/this weekend/monday.

src/pages/settings/ProfilePage/LoginField.js Outdated Show resolved Hide resolved
src/pages/settings/ProfilePage/LoginField.js Outdated Show resolved Hide resolved
src/pages/settings/ProfilePage/LoginField.js Outdated Show resolved Hide resolved
src/pages/settings/ProfilePage/index.js Outdated Show resolved Hide resolved
src/pages/settings/ProfilePage/index.js Outdated Show resolved Hide resolved
NikkiWines
NikkiWines previously approved these changes Apr 5, 2021
Copy link
Contributor

@NikkiWines NikkiWines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Added some nabby comments but let's :shipit:

I have a couple PRs up to route the validation links back to E.cash instead of E.com so no need to hold this one.

src/libs/actions/User.js Outdated Show resolved Hide resolved
src/pages/settings/AddSecondaryLoginPage.js Outdated Show resolved Hide resolved
src/pages/settings/ProfilePage/LoginField.js Outdated Show resolved Hide resolved
Copy link
Contributor

@NikkiWines NikkiWines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@timszot timszot merged commit 5ab2683 into Expensify:master Apr 6, 2021
Copy link
Contributor

@tgolen tgolen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please submit a new PR to fix these


// Route object from navigation
route: PropTypes.shape({
params: PropTypes.shape({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are missing inline comments, please add them

Onyx.merge(ONYXKEYS.USER, {error: ''});
}

submitForm() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing method docs

});
}

// Determines whether form is valid
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not valid method docs


// Login associated with the user
login: PropTypes.shape({
partnerUserID: PropTypes.string,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing inline comments

this.onResendClicked = this.onResendClicked.bind(this);
}

onResendClicked() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing method docs

setAutomaticTimezone(isAutomaticTimezone) {
this.setState(({selectedTimezone}) => ({
isAutomaticTimezone,
selectedTimezone: isAutomaticTimezone ? moment.tz.guess() : selectedTimezone,
}));
}

// Get the most validated login of each type
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Invalid method docs

@isagoico
Copy link

isagoico commented Apr 7, 2021

Title:
iOS - 1.0.13-0 - Profile - Both email and phone number options are displayed for secondary login

Expected Result:

Only Phone number field displayed to add as secondary login

Actual Result:

Both email and phone number fields are displayed for secondary login

Action Performed:

  1. Launch the app and login with email account
  2. Tap Profile > Add

Workaround:

Unknown

Platform:

Where is this issue occurring?

Web
iOS ✔️
Android
Desktop App
Mobile Web

**Version Number:**1.0.13-0

Logs: https://stackoverflow.com/c/expensify/questions/4856

Notes/Photos/Videos:
We were able to reproduce this only in the iOS app.

Expensify/Expensify Issue URL:

@NikkiWines
Copy link
Contributor

@isagoico what is the primary login for this user

@isagoico
Copy link

isagoico commented Apr 7, 2021

I was able to reproduce this on my test account with the primary log in of "[email protected] / 123456Isa"

@NikkiWines
Copy link
Contributor

NikkiWines commented Apr 7, 2021

Huh, I can't reproduce this at all on a fresh account Oops, didn't read this. I see this is only happening on iOS

@NikkiWines
Copy link
Contributor

Probably related: #2253

@NikkiWines
Copy link
Contributor

Ah @Maftalion correctly identified the root cause, which we discussed earlier on but never added into this PR. We need to modify returnValueList: ['account', 'loginList', 'nameValuePairs'] to be returnValueList: account,loginList, nameValuePairs, here otherwise mobile doesn't return the correct values.

I was able to repro on dev and confirm the fix resolved the issue (for iOS, looking to see if the android whitescreen is related)

Old New

@isagoico
Copy link

isagoico commented Apr 7, 2021

Forgot to mention above. We were unable execute the steps of this PR in the Android app because of this issue #2253

@NikkiWines
Copy link
Contributor

NikkiWines commented Apr 7, 2021

I am not able to reproduce that android whitescreen issue locally

Edit: whitescreen issue is resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[User Settings] Allow users to add secondary logins
6 participants