Skip to content

Commit

Permalink
magento#8952 Fixed subscribe to newsletter if you already have an acc…
Browse files Browse the repository at this point in the history
…ount issue update changes as per suggestion
  • Loading branch information
ravi-chandra3197 committed Oct 29, 2018
1 parent a2d02fe commit 6de5586
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions app/code/Magento/Newsletter/Controller/Subscriber/NewAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,12 @@ public function __construct(
protected function validateEmailAvailable($email)
{
$websiteId = $this->_storeManager->getStore()->getWebsiteId();
if (isset($this->_customerSession->getCustomerDataObject()->getEmail())) {
if ($this->_customerSession->getCustomerDataObject()->getEmail() !== $email
&& !$this->customerAccountManagement->isEmailAvailable($email, $websiteId)
) {
throw new LocalizedException(
__('This email address is already assigned to another user.')
);
}
if (isset($this->_customerSession->getCustomerDataObject()->getEmail()) && ($this->_customerSession->getCustomerDataObject()->getEmail() !== $email
&& !$this->customerAccountManagement->isEmailAvailable($email, $websiteId)
)) {
throw new \Magento\Framework\Exception\LocalizedException(
__('This email address is already assigned to another user.')
);
}
}

Expand Down

0 comments on commit 6de5586

Please sign in to comment.