-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Multiple newsletter confirmation emails sent #12876
Copy link
Copy link
Closed
Labels
Fixed in 2.2.xThe issue has been fixed in 2.2 release lineThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseThe issue has been reproduced on latest 2.3 release
Metadata
Metadata
Assignees
Labels
Fixed in 2.2.xThe issue has been fixed in 2.2 release lineThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseThe issue has been reproduced on latest 2.3 release
Preconditions
Steps to reproduce
Stores > Configuration > Customers > Newsletter > Subscription Options > Need to Confirmto YesExpected result
There are a couple different results that I'll leave to the Magento core team:
STATUS_UNCONFIRMED, update the guest email with the customer data, and send the Need to Confirm email for the new account.Actual result
Reason
The first two emails are received because of the
\Magento\Newsletter\Model\Plugin\CustomerPlugin::afterSave()method. When\Magento\Customer\Controller\Account\CreatePost::execute()is called a new customer account is created online 313with\Magento\Customer\Model\AccountManagement::createAccount(). ThecreateAccount()method callscreateAccountWithPasswordHash()whereby the customer is saved online 748and then that same method calls$this->changeResetPasswordLinkToken()online 775, which again saves the customer online 1242. Thus these two customer saves trigger theafterSave()method calls on theCustomerPlugin, which updates the subscription and sends the two emails.The third and final email is received within the
Magento\Customer\Controller\Account\CreatePost::execute()method online 317when theis_subscribedparam is retrieved from the form data within the request and theifconditional equalstruebecause of Step 4 above.