Email has already been taken in purchase flow
Initial Problem
When we create a subscription on the GitLab purchase flow, we will first attempt to create/find the customer.
If a CDot account with the same email address as the GitLab.com already exists, but it is not linked to the GitLab.com account, then the customer will see the {"email"=>["has already been taken"]}
error.
![](https://gitlab.com/gitlab-org/gitlab/uploads/1f768be195aaa5dd7771fcf633cddadc/Screen_Shot_2021-07-29_at_5.28.26_PM.png)
We see a lot of that error for /-/subscriptions
: https://sentry.gitlab.net/gitlab/gitlabcom/issues/2602103/events/?query=SubscriptionPortalRESTException
Steps to reproduce
- Create a new account on CDot without using GitLab.com to authenticate
- Create a GitLab.com account with the same email address
- Attempt to make a purchase from GitLab.com
Solution Discussion
See proposed solutions in this comment. When we've landed on a final solution, the issue description will be updated.
Problem Scenarios
Initial Problem - GL & CDot not linked
Scenario 1:- Customer has CDot account with
a
email - Customer has gitlab account with
a
email - 1 is not linked to 2
- Gitlab purchase with
a
email attempted ={"email"=>["has already been taken"]}
error.
Sub-scenario: 1 & 2 are not linked because link has been broken
Scenario 1: Solution
- Make 1 linked to 2
- Mockup
Mismatch E-mails are Linked ; No SaaS Subscriptions on CDot
Scenario 2:- Customer has CDot account with
a
e-mail & no active SaaS subscriptions - Customer has gitlab account with
b
e-mail - 1 and 2 are linked
- Customer has gitlab account with
a
e-mail - Gitlab purchase with
a
email attempted ={"email"=>["has already been taken"]}
error.
Scenario 2: Solution
- Make 1 linked to 4 ; no customer choice
- Mockup
Subscriptions on CDot
Scenario 3: Mismatch E-mails are Linked ;- Customer has CDot account with
a
e-mail & has active SaaS subscription(s) - Customer has gitlab account with
b
e-mail - 1 and 2 are linked
- Customer has gitlab account with
a
e-mail - Gitlab purchase with
a
email attempted ={"email"=>["has already been taken"]}
error.
Scenario 3: Solution
- Ask customer to change email in 1 from
a
tob
orc
- Mockup
Proposed Solution
Add a banner when the "has already been taken" error occurs with the following text (existing solution):
An error occurred with your purchase. We detected a Customers Portal account that matches your email address, but it has not been linked to your GitLab.com account. Follow the instructions to link your Customers Portal account, and retry the purchase. If the problem persists, contact support.
Additional Notes
Additional requirements:
-
Forgot password functionality:
Most customers who do not know they have a CustomersDot account with their email or haven't linked their GitLab account have also forgotten their password. Would the current forgot password workflow work without problems with the modal design we have?
-
Leverage CDot API:
use CustomersDot API instead of loading the Sign In page directly to mitigate any potential problem with CSP.