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

Handle "Email address is taken" on Login page #3950

Merged
merged 1 commit into from
Apr 15, 2021
Merged

Conversation

AlexTugarev
Copy link
Member

@AlexTugarev AlexTugarev commented Apr 15, 2021

This PR adds a check for already taken email addresses on signup. You supposed to see a message on the Login page that explains why a signup with an Identity Provider didn't work, because you previously created a Gitpod account with a different IdP but matching email address.

The intention of this change is to minimize the unintentional creation of second Gitpod accounts, just by using a different IdP.

Try it yourself:

  • make sure you have a GH and a GL session and the primary email address is matching
  • sign up with one provider first
  • logout
  • try to sign up with the second provider
  • see the error message

Screen Shot 2021-04-15 at 15 31 00

––

This PR also fixes #3801

How to test:

  • go to GH setting and revoke access for the Gitpod Preview Environments OAuth app
  • try to sign up and decline(!)
  • see the error message

Screen Shot 2021-04-15 at 15 29 07

@gtsiolis
Copy link
Contributor

gtsiolis commented Apr 15, 2021

Looking at this in a moment! 👀

Feel free to update the description if there are any particular steps to follow to help reviewing this.

@gtsiolis gtsiolis added aspect: authentication This is a broad, abstract, and almost impractical category that we have yet to sort out. component: dashboard type: improvement Improves an existing feature or existing code labels Apr 15, 2021
@gtsiolis gtsiolis added this to the April 2021 milestone Apr 15, 2021
@AlexTugarev
Copy link
Member Author

gitlab.com uses a similar strategy BTW

Screen Shot 2021-04-15 at 12 13 34

Copy link
Contributor

@gtsiolis gtsiolis left a comment

Choose a reason for hiding this comment

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

Thanks for adding this @AlexTugarev and the detailed write-up on how to review this! 🌟

FWIW, this pattern could become useful for tackling similar issues like #3836.

Left some minor comments below, feel free to resolve these here or in a follow up PR.

There are only three changes that would be great to go into this PR:

  1. Center align the alert component.
  2. Limit alert width using w-96.
  3. Add some margin below the alert.

Pasting below how this could ideally look like.

Error

@@ -126,6 +136,12 @@ export function Login() {
</div>
</div>
</div>
{emailTaken && (<div className="bg-gitpod-kumquat-light rounded-md p-3 text-gitpod-red text-sm mb-2">
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: Alerts like this can use a larger radius to differentiate them from inputs or other elements as we do in the garbage collection message in the workspaces lists.

Some thoughts on this:

  1. This pattern will become more clear and consistent as its product design evolves.
  2. Similarly, colors used for each alert type will also become more clear as design guidelines shape up.
Suggested change
{emailTaken && (<div className="bg-gitpod-kumquat-light rounded-md p-3 text-gitpod-red text-sm mb-2">
{emailTaken && (<div className="bg-gitpod-kumquat-light rounded-xl p-3 text-gitpod-red text-sm mb-2">

Copy link
Member Author

Choose a reason for hiding this comment

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

Could we add some reuseable components for that, please? Each time I pick one example from somewhere else, it's the wrong one.

Copy link
Contributor

Choose a reason for hiding this comment

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

Strong vote for YES!

This is common due to a) some design experimentations added on purpose in some pages and b) our MVC approach with helps us ship faster and unblock code reviews. The need to introduce a reusable component library will become more clear on the way as a) the product evolves and b) team members try to add or improve product features on more areas.

For this iteration, going with the rounded-xl class should suffice. WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure! ☝🏻 updated the screenshots in the description above.

{emailTaken && (<div className="bg-gitpod-kumquat-light rounded-md p-3 text-gitpod-red text-sm mb-2">
{`Email address is already in use. Please log in with ${emailTaken.otherUser.authHost}.`}
</div>)}
{errorMessage && (<div className="bg-gitpod-kumquat-light rounded-md p-3 text-gitpod-red text-sm mb-2">
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: Radius fix.

Suggested change
{errorMessage && (<div className="bg-gitpod-kumquat-light rounded-md p-3 text-gitpod-red text-sm mb-2">
{errorMessage && (<div className="bg-gitpod-kumquat-light rounded-xl p-3 text-gitpod-red text-sm mb-2">

@@ -126,6 +136,12 @@ export function Login() {
</div>
</div>
</div>
{emailTaken && (<div className="bg-gitpod-kumquat-light rounded-md p-3 text-gitpod-red text-sm mb-2">
Copy link
Contributor

@gtsiolis gtsiolis Apr 15, 2021

Choose a reason for hiding this comment

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

suggestion: What do you think of making this alert component dismissible?

Copy link
Member Author

Choose a reason for hiding this comment

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

Given that the Login page is just a stop between here and there, I'd personally never try to dismiss it, but if you think this is useful 🤷🏻‍♂️ let's add it. Also it's dismissed on next try to connect.

Copy link
Contributor

Choose a reason for hiding this comment

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

It should be fine as non-dismissible for now as the task is blocked if no action is taken. Usually, an alert component is non-dismissible when the user is prevented from completing a task until a system-condition is met. Since this is user-driven and not relying on a system condition, a dismissible alert is probably the correct approach here. 💡

However, we can tackle this in a follow up issue going through all alerts and make sure we make dismissible the ones needed. Your call! 📞

Copy link
Member Author

Choose a reason for hiding this comment

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

However, we can tackle this in a follow up issue going through all alerts and make sure we make dismissible the ones needed. Your call! 📞

sounds good!

components/dashboard/src/Login.tsx Outdated Show resolved Hide resolved
components/dashboard/src/Login.tsx Outdated Show resolved Hide resolved
@@ -126,6 +136,12 @@ export function Login() {
</div>
</div>
</div>
{emailTaken && (<div className="bg-gitpod-kumquat-light rounded-md p-3 text-gitpod-red text-sm mb-2">
{`Email address is already in use. Please log in with ${emailTaken.otherUser.authHost}.`}
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: Ideally, we could have a title text for briefly explaining what happened and a body text to clarify what needs to be done. This way we can also make the title more prominent. We can tackle this separately and leave this as is for now in one piece.

* already taken email addresses should be rejected on signup
* OAuth errors (e.g. access_denied) should be propagated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aspect: authentication This is a broad, abstract, and almost impractical category that we have yet to sort out. component: dashboard type: improvement Improves an existing feature or existing code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Does decline work with GitHub?
2 participants