Skip to content

Reset Password Email Issue on Multi Store from Admin #5726

@ngashokkumar

Description

@ngashokkumar

Steps to reproduce

  1. Login to Magento Backend
  2. Create Multi Store with Two Different Stores
  3. Go to Magento Store Frontend in both the Stores
  4. Register Customer on both the Stores from Frontend
  5. Login to Magento Backend if not loggedin already
  6. go to Customers -> All Customers
  7. Find the Customer Id which you have Registered on the Store 2
  8. Click on Edit Customer
  9. Click on the Reset Password Link on the Top

Expected result

  1. The Customer Registered on the Second Store Should Receive the Mail from the Second Store with the Reset Password Link for the Second Store

Actual result

  1. The Customer Regsitered on the Second Store gets the Email from the Default Store or the First Store

    Solution:

    Inside the Customer AccountManagement.php Model(vendor/magento/module-customer/Model)

Inside sendPasswordReminderEmail function change
Replace:

 public function sendPasswordReminderEmail($customer)
    {
       $storeId = $this->storeManager->getStore()->getId();


    if (!$storeId) {
        $storeId = $this->getWebsiteStoreId($customer);
    }

    $customerEmailData = $this->getFullCustomerObject($customer);

    $this->sendEmailTemplate(
        $customer,
        self::XML_PATH_REMIND_EMAIL_TEMPLATE,
        self::XML_PATH_FORGOT_EMAIL_IDENTITY,
        ['customer' => $customerEmailData, 'store' => $this->storeManager->getStore($storeId)],
        $storeId
    );

    return $this;
}

with:

 public function sendPasswordReminderEmail($customer)
    {  
        // Need to Get Store Id from the Customer Account
        $storeId = $customer->getStoreId();


    if (!$storeId) {
        $storeId = $this->getWebsiteStoreId($customer);
    }

    $customerEmailData = $this->getFullCustomerObject($customer);

    $this->sendEmailTemplate(
        $customer,
        self::XML_PATH_REMIND_EMAIL_TEMPLATE,
        self::XML_PATH_FORGOT_EMAIL_IDENTITY,
        ['customer' => $customerEmailData, 'store' => $this->storeManager->getStore($storeId)],
        $storeId
    );

    return $this;
}

Metadata

Metadata

Labels

Fixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is not validGate 1 Failed. Automatic verification of issue format is failedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseReproduced 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 releasebug reportgood first issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions