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

Make the NewDot login flow work with domain-controlled accounts #5218

Merged
merged 4 commits into from
Sep 17, 2021

Conversation

Gonals
Copy link
Contributor

@Gonals Gonals commented Sep 13, 2021

@nickmurray47 πŸ»β€β„οΈ

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/176617#

Tests

  1. Create an email using EmailOnDeck.
  2. Create and validate the account via ./script/clitools.sh generator:account, then run ./script/clitools.sh generator:domain to generate a domain with it as its admin.
  3. Create another email using EmailOnDeck. If you create the account in the same day it should have the same domain.
  4. Add this account to the DEV_EMAILS const in _.config.local.php.
  5. Use this account to sign up for NewDot (don't use any clitools scripts to validate the account). Then, run vssh php ./Web-Expensify/script/notifyall.php.
  6. You should get an email in EmailOnDeck. Use the link in the email to set a password.
    • You might have to modify the link format, make sure it's in this format: <baseURL>/setpassword/<accountID>/<validateCode>.
  7. Populate the password fields and complete the form. You should get logged in.

QA Steps

  1. With a fresh email (with no account) in a controlled domain, try to create a new account in newdot.
  2. You should get a magic link in your email. Make sure it points to newdot and not oldDot (this is a different bug currently being fixed in another PR). The format should be new.expensify.com/setpassword/<accountID>/<validateCode>. If it isn't, just change it to that format.
  3. Populate the password fields and submit the form.
  4. You should get logged in.

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web

Mobile Web

Desktop

iOS

Android

@Gonals Gonals requested a review from a team as a code owner September 13, 2021 12:53
@Gonals Gonals self-assigned this Sep 13, 2021
@MelvinBot MelvinBot requested review from iwiznia and removed request for a team September 13, 2021 12:54
@Gonals Gonals changed the title Make the NewDot login flow work with domain-controlled accounts [HOLD] Make the NewDot login flow work with domain-controlled accounts Sep 13, 2021
@Gonals Gonals requested review from nickmurray47 and removed request for iwiznia September 13, 2021 12:54
@Gonals
Copy link
Contributor Author

Gonals commented Sep 13, 2021

Setting @nickmurray47 as reviewer, since he has been assigned to the web PR counterpart

Copy link
Contributor

@iwiznia iwiznia left a comment

Choose a reason for hiding this comment

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

See my comment in web PR

@jasperhuangg jasperhuangg self-requested a review September 15, 2021 00:30
@jasperhuangg jasperhuangg changed the title [HOLD] Make the NewDot login flow work with domain-controlled accounts Make the NewDot login flow work with domain-controlled accounts Sep 15, 2021
jasperhuangg
jasperhuangg previously approved these changes Sep 15, 2021
Copy link
Contributor

@jasperhuangg jasperhuangg left a comment

Choose a reason for hiding this comment

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

nickmurray47
nickmurray47 previously approved these changes Sep 16, 2021
Copy link
Contributor

@nickmurray47 nickmurray47 left a comment

Choose a reason for hiding this comment

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

also LGTM and tests well

@Gonals
Copy link
Contributor Author

Gonals commented Sep 16, 2021

All yours, @iwiznia!

accountID,
validateCode,
}).then((responseValidate) => {
if (responseValidate.jsonCode === 200) {
Copy link
Contributor

Choose a reason for hiding this comment

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

No error message if this fails?

Copy link
Contributor

Choose a reason for hiding this comment

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

And if the ValidateEmail call fails.. what is the user supposed to do?

Another thought, if the validate code is bad why make them enter a password at all?

Copy link
Contributor Author

@Gonals Gonals Sep 21, 2021

Choose a reason for hiding this comment

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

  • Hmmm. Ask for another code, I imagine?
  • Mainly because we don't know yet πŸ˜›. What are you thinking? Calling validate on page load, for example? That would probably work.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ask for another code, I imagine?

Ahaha asking because when I ran through this flow I just get stuck looking at an error message with no buttons or anything.

Calling validate on page load, for example? That would probably work.

Sure, this is what we do on OldDot.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can create another issue to nail these two down, if you want. I think validating on load makes sense and would make the flow a bit better, and if validation fails, we can display the error and a button/link to resend the magic link?

I don't think we need them to go live with N6, but they seem like good improvements

password: this.state.password,
}).then((responsePassword) => {
if (responsePassword.jsonCode === 200) {
signIn(this.state.password);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to call signIn? Is it because validate and changePassword do not set the authToken cookie or what?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep. SignIn sets the cookie and redirects us to where we want to go, I believe

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think there are any cookies in New Expensify. We mostly need to do this to create the "device login" to make the re-authentication logic work correctly.

@Gonals Gonals dismissed stale reviews from nickmurray47 and jasperhuangg via a9bdce2 September 16, 2021 16:09
@Gonals
Copy link
Contributor Author

Gonals commented Sep 16, 2021

Added error messages!

Copy link
Contributor

@nickmurray47 nickmurray47 left a comment

Choose a reason for hiding this comment

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

Re-tested and new error messages look solid!

Screen Shot 2021-09-16 at 4 12 25 PM

@Gonals
Copy link
Contributor Author

Gonals commented Sep 17, 2021

@iwiznia all yours once again!

@iwiznia iwiznia merged commit a995d4d into main Sep 17, 2021
@iwiznia iwiznia deleted the alberto-magicNew branch September 17, 2021 10:09
@OSBotify
Copy link
Contributor

βœ‹ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

lodashGet(this.props.route, 'params.validateCode', ''),
lodashGet(this.props.route, 'params.accountID', ''),
);
API.ValidateEmail({
Copy link
Contributor

Choose a reason for hiding this comment

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

I am pretty sure this broke the page for when the account is already validated... The API returns 405 Account already validated.

Copy link
Contributor

Choose a reason for hiding this comment

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

@OSBotify
Copy link
Contributor

πŸš€ Deployed to staging by @iwiznia in version: 1.0.99-5 πŸš€

platform result
πŸ€– android πŸ€– success βœ…
πŸ–₯ desktop πŸ–₯ success βœ…
🍎 iOS 🍎 success βœ…
πŸ•Έ web πŸ•Έ success βœ…

@mvtglobally
Copy link

@Gonals @marcaaron @flodnv What environments should we verify this PR?
Can you also confirm we should be able to run this PR with Expensifail account?

@Gonals
Copy link
Contributor Author

Gonals commented Sep 21, 2021

@Gonals @marcaaron @flodnv What environments should we verify this PR?
Can you also confirm we should be able to run this PR with Expensifail account?

Hey! This should be tested in staging.
I think Expensifail is domain-controlled, so it should work for this just fine :)

@OSBotify
Copy link
Contributor

πŸš€ Deployed to production by @Jag96 in version: 1.1.0-2 πŸš€

platform result
πŸ€– android πŸ€– success βœ…
πŸ–₯ desktop πŸ–₯ success βœ…
🍎 iOS 🍎 success βœ…
πŸ•Έ web πŸ•Έ success βœ…

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.

8 participants