You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: www/apps/book/public/llms-full.txt
+32-2Lines changed: 32 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -23274,9 +23274,39 @@ When this or another guest customer registers an account with the same email, a
23274
23274
23275
23275
## Email Uniqueness
23276
23276
23277
-
The above behavior means that two `Customer` records may exist with the same email. However, the main difference is the `has_account` property's value.
23277
+
The above behavior means that two `Customer` records may exist with the same email address. However, the main difference is the `has_account` property's value.
23278
23278
23279
-
So, there can only be one guest customer (having `has_account=false`) and one registered customer (having `has_account=true`) with the same email.
23279
+
So, there can only be one guest customer (having `has_account=false`) and one registered customer (having `has_account=true`) with the same email address.
23280
+
23281
+
***
23282
+
23283
+
## Customer Deletion and Email Reuse
23284
+
23285
+
When a merchant deletes a customer, the `Customer` record is soft-deleted, meaning it is not permanently removed from the database.
23286
+
23287
+
When using the Medusa Application with the [Auth Module](https://docs.medusajs.com/Users/shahednasser/medusa/www/apps/resources/app/commerce-modules/auth/index.html.md), possible confusion may arise in the following scenarios:
23288
+
23289
+
1. An admin user is using the email address `[email protected]`, and a customer tries to register with the same email address.
23290
+
2. An admin user has deleted a customer with the email address `[email protected]`, and another customer tries to register with the same email address.
23291
+
23292
+
In these and similar scenarios, the customer trying to register will receive an error message indicating that the email address is already in use:
23293
+
23294
+
```json
23295
+
{
23296
+
"type": "unauthorized",
23297
+
"message": "Identity with email already exists"
23298
+
}
23299
+
```
23300
+
23301
+
To resolve this, you can amend the registration flow to:
23302
+
23303
+
1. Retrieve the login token of the existing identity with the same email address.
23304
+
2. Use the login token when registering the new customer. This will not remove the existing identity but will allow the new customer to register with the same email address.
23305
+
23306
+
You can learn more about how to implement this flow in the following guides:
23307
+
23308
+
- [Conceptual guide on how to implement this flow with Medusa's authentication routes](https://docs.medusajs.com/Users/shahednasser/medusa/www/apps/resources/app/commerce-modules/auth/authentication-route#handling-existing-identities/index.html.md).
23309
+
- [How-to guide on how to implement this in a storefront](https://docs.medusajs.com/Users/shahednasser/medusa/www/apps/resources/app/storefront-development/customers/register/index.html.md).
Copy file name to clipboardExpand all lines: www/apps/resources/app/commerce-modules/customer/customer-accounts/page.mdx
+32-2Lines changed: 32 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,6 +24,36 @@ When this or another guest customer registers an account with the same email, a
24
24
25
25
## Email Uniqueness
26
26
27
-
The above behavior means that two `Customer` records may exist with the same email. However, the main difference is the `has_account` property's value.
27
+
The above behavior means that two `Customer` records may exist with the same email address. However, the main difference is the `has_account` property's value.
28
28
29
-
So, there can only be one guest customer (having `has_account=false`) and one registered customer (having `has_account=true`) with the same email.
29
+
So, there can only be one guest customer (having `has_account=false`) and one registered customer (having `has_account=true`) with the same email address.
30
+
31
+
---
32
+
33
+
## Customer Deletion and Email Reuse
34
+
35
+
When a merchant deletes a customer, the `Customer` record is soft-deleted, meaning it is not permanently removed from the database.
36
+
37
+
When using the Medusa Application with the [Auth Module](../../auth/page.mdx), possible confusion may arise in the following scenarios:
38
+
39
+
1. An admin user is using the email address `[email protected]`, and a customer tries to register with the same email address.
40
+
2. An admin user has deleted a customer with the email address `[email protected]`, and another customer tries to register with the same email address.
41
+
42
+
In these and similar scenarios, the customer trying to register will receive an error message indicating that the email address is already in use:
43
+
44
+
```json
45
+
{
46
+
"type": "unauthorized",
47
+
"message": "Identity with email already exists"
48
+
}
49
+
```
50
+
51
+
To resolve this, you can amend the registration flow to:
52
+
53
+
1. Retrieve the login token of the existing identity with the same email address.
54
+
2. Use the login token when registering the new customer. This will not remove the existing identity but will allow the new customer to register with the same email address.
55
+
56
+
You can learn more about how to implement this flow in the following guides:
57
+
58
+
-[Conceptual guide on how to implement this flow with Medusa's authentication routes](../../auth/authentication-route/page.mdx#handling-existing-identities).
59
+
-[How-to guide on how to implement this in a storefront](../../../storefront-development/customers/register/page.mdx).
0 commit comments