Skip to content

Reset Password Confirmation Link Email Not Store Scoped For Global Customers #23295

@floorz

Description

@floorz

Preconditions (*)

  1. 2.2.4
  2. 2.2.5
  3. 2.2.6
  4. 2.2.7
  5. 2.2.8
  6. 2.3.0
  7. 2.3.1

Steps to reproduce (*)

  1. Setup multi-store site with at least 2 websites
  2. Configure customer accounts to be shared globally from admin
  3. Create a customer account associated to the second website
  4. Initiate reset password email via rest api at PUT /V1/customers/password
    Payload:
{
	"email": "user@example.com",
	"template": "email_reset"
}
  1. Receive reset password email from the default store, not the second store

Expected result (*)

  1. Receive email from the store the customer is assigned to

Actual result (*)

  1. Received email from the initial default store and not the store the customer is assigned to

Use Case Information

We have a client on Magento Cloud with separate websites setup for each region/language (US, Canada, United Kingdom, Spain, China, Japan, etc.). They have mobile apps that will allow customers to register, sign in, register products (custom), and initiate reset password. We needed separate websites to support different base currencies per website.

The mobile apps don't know which website url to use until a customer authenticates which caused a chicken/egg situation with authentication/account creation. We made customer accounts global so the mobile apps can hit the default website url for authentication and be scoped based on the customer's token/assigned store.

The reset password endpoint appears to ignore the customer's store and use the store derived from the website url scoping.

Investigation

In a couple of other methods in the same \Magento\Customer\Model\EmailNotification class, the customer's assigned store id is used instead of the store derived from website domain/url scoping:

https://github.com/magento/magento2/blob/2.3.1/app/code/Magento/Customer/Model/EmailNotification.php#L169-L172
https://github.com/magento/magento2/blob/2.3.1/app/code/Magento/Customer/Model/EmailNotification.php#L195-L198
https://github.com/magento/magento2/blob/2.3.1/app/code/Magento/Customer/Model/EmailNotification.php#L220-L223
https://github.com/magento/magento2/blob/2.3.1/app/code/Magento/Customer/Model/EmailNotification.php#L319-L322

This seems to be the only method not using customer's store id, and the one causing this issue:
https://github.com/magento/magento2/blob/2.3.1/app/code/Magento/Customer/Model/EmailNotification.php#L343-L346

I'm sort of confused about which approach is the correct approach on a broader level, relying on the website domain/url for determining website scope, or the data passed in being website aware like in the case of the customer.

Metadata

Metadata

Assignees

Labels

Component: StoreFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions