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

feat: Add password authentication flow #2329

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

reefdog
Copy link
Collaborator

@reefdog reefdog commented Apr 28, 2021

🚨 Blocker:🚨

This PR shouldn't be merged until we resolve an issue we discovered.

Description:

This PR replaces passwordless email login with a password authentication flow using Auth0's Universal Login. It also adds explanatory text to guide users through the change, including a direct sign-up link.

117038376-2c832f00-accd-11eb-867c-788bdddf4ef3

It also:

  • Prefills the email fields on the Universal Login screen with whatever the user entered.
  • Passes the user's language preference from Streetmix over to Auth0, so the Universal Login screen properly translates. (Exceptions are Catalan and Arabic, which Auth0 doesn't yet support.)
  • Does some very light unrelated code cleanup, basically just some comment re-writing and replacing direct this.state calls with destructured assignment. Normally I don't believe in doing cleanup alongside new work, but I had to write similar code alongside these old patterns and had to choose between consistency with those incorrect patterns, causing an inconsistency in a single file, or just cleaning up the problems. I chose the latter. (Laster?)

Prerequisites and deployment:

Before merging this, we should:

(We have to do all three of those things to be in good standing and be able to serve the New Experience Universal Login screen without a dev-key scold.)

After deploying this, we should immediately:

  • Enable the New Universal Login screen in Auth0. (It's prettier, faster, has better i18n support, and lets us link directly to the signup tab.)

Closes #2023
@whitmanschorn did the original spike in #2035, so I've tagged him as co-author. 🙏🏼

@codecov
Copy link

codecov bot commented Apr 28, 2021

Codecov Report

Merging #2329 (63df4cf) into main (d0b92b5) will decrease coverage by 0.18%.
The diff coverage is 33.33%.

❗ Current head 63df4cf differs from pull request most recent head 53adbb2. Consider uploading reports for the commit 53adbb2 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2329      +/-   ##
==========================================
- Coverage   47.31%   47.13%   -0.19%     
==========================================
  Files         272      272              
  Lines        9178     9161      -17     
  Branches     2153     2174      +21     
==========================================
- Hits         4343     4318      -25     
- Misses       4340     4345       +5     
- Partials      495      498       +3     
Impacted Files Coverage Δ
assets/scripts/app/routing.js 4.34% <0.00%> (+0.34%) ⬆️
assets/scripts/dialogs/SignInDialog.jsx 40.62% <37.50%> (-4.66%) ⬇️
assets/scripts/dialogs/NewsletterDialog.jsx 86.66% <0.00%> (-13.34%) ⬇️
assets/scripts/palette/PaletteItems.jsx 91.30% <0.00%> (-8.70%) ⬇️
assets/scripts/menus/EnvironmentBadge.jsx 91.30% <0.00%> (-8.70%) ⬇️
assets/scripts/streets/image.js 14.00% <0.00%> (-1.22%) ⬇️
app/resources/v1/users.js 54.68% <0.00%> (-0.58%) ⬇️
assets/scripts/app/WelcomePanel.jsx 73.52% <0.00%> (-0.39%) ⬇️
app/bundle.js 0.00% <0.00%> (ø)
assets/scripts/ui/Icon.jsx 73.33% <0.00%> (ø)
... and 14 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d0b92b5...53adbb2. Read the comment docs.

louh
louh previously requested changes Apr 29, 2021
assets/scripts/dialogs/SignInDialog.jsx Outdated Show resolved Hide resolved
@reefdog reefdog requested a review from louh April 29, 2021 22:04
@reefdog reefdog marked this pull request as ready for review April 29, 2021 22:04
@reefdog reefdog changed the title feat: Add Auth0 Universal Login feat: Add password authentication flow Apr 29, 2021
@reefdog reefdog force-pushed the reefdog/use-universal-login branch from 122eb7b to cb21617 Compare April 29, 2021 22:21
@reefdog reefdog dismissed louh’s stale review April 30, 2021 13:33

Resolved, in a way

@reefdog reefdog force-pushed the reefdog/use-universal-login branch 5 times, most recently from 7b01ae9 to faed538 Compare May 4, 2021 16:36
@reefdog reefdog added the not-ready The PR is not yet ready for merging label May 31, 2021
@reefdog reefdog marked this pull request as draft May 31, 2021 20:32
@reefdog reefdog force-pushed the reefdog/use-universal-login branch from faed538 to 63df4cf Compare June 4, 2021 16:09
@netlify
Copy link

netlify bot commented Aug 17, 2021

✔️ Deploy Preview for streetmix-docs canceled.

🔨 Explore the source changes: 53adbb2

🔍 Inspect the deploy log: https://app.netlify.com/sites/streetmix-docs/deploys/6123b68324d50e000907a2ea

@reefdog reefdog force-pushed the reefdog/use-universal-login branch from 127b4c0 to 1935106 Compare August 17, 2021 22:29
reefdog and others added 4 commits August 23, 2021 09:53
This commit adds support for logging in via password using the Auth0
Universal Login screen.

It keeps around the existing magic link support, but relegates it to a
secondary (well, stylistically tertiary) button. Native form submit of
the email field now goes to the password login.

To ease users into it, we added explanatory text advertising the
feature and also directing them to the sign up page, although they can
also sign up from the login page itself.

It also replaces a few `this.state` direct-usages with destructured
assignments as a small bit of inline cleanup.

Co-authored-by: Whitman Schorn <whitman.schorn@gmail.com>
It turns out that the new Universal Login experience at Auth0 doesn’t
yet support passwordless login, something I unfortunately didn’t catch
during 336f4b7.

Given the choice between abandoning new Universal Login or migrating
all email users to passworded accounts, we prefer the latter.

This change comments-out (with DEPRECATED notes) the magic link code
and changes the sign in dialog language. We will eventually remove the
deprecated code once we’re sure of the permanency of this decision.
This wasn't actually affecting us, but it was causing developer (me)
confusion: we declare the `user` const in this block, and then again in
a lower scope (the API callback).

To alleviate that confusion, I renamed the constant at this scope.

Done during but not directly related to #2023.
Adds an error page for when users attempt to login with an unverified
email, along with a couple of TODOs for completing the work.

Affects #2023
@reefdog reefdog force-pushed the reefdog/use-universal-login branch from 1935106 to 53adbb2 Compare August 23, 2021 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not-ready The PR is not yet ready for merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Username / password authentication megathread
2 participants