Skip to content

Commit bfa47bb

Browse files
MAGETWO-99636: Newsletter subscribe and unsubscribe emails sent when User creates account from Invitation account
1 parent 8080f7e commit bfa47bb

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

app/code/Magento/Customer/Controller/Account/CreatePost.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
use Magento\Customer\Controller\AbstractAccount;
4040

4141
/**
42+
* Post create customer action
43+
*
4244
* @SuppressWarnings(PHPMD.TooManyFields)
4345
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
4446
*/
@@ -158,8 +160,8 @@ class CreatePost extends AbstractAccount implements CsrfAwareActionInterface, Ht
158160
* @param CustomerExtractor $customerExtractor
159161
* @param DataObjectHelper $dataObjectHelper
160162
* @param AccountRedirect $accountRedirect
161-
* @param Validator $formKeyValidator
162163
* @param CustomerRepository $customerRepository
164+
* @param Validator $formKeyValidator
163165
*
164166
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
165167
*/
@@ -337,22 +339,16 @@ public function execute()
337339
return $this->resultRedirectFactory->create()
338340
->setUrl($this->_redirect->error($url));
339341
}
340-
341342
$this->session->regenerateId();
342-
343343
try {
344344
$address = $this->extractAddress();
345345
$addresses = $address === null ? [] : [$address];
346-
347346
$customer = $this->customerExtractor->extract('customer_account_create', $this->_request);
348347
$customer->setAddresses($addresses);
349-
350348
$password = $this->getRequest()->getParam('password');
351349
$confirmation = $this->getRequest()->getParam('password_confirmation');
352350
$redirectUrl = $this->session->getBeforeAuthUrl();
353-
354351
$this->checkPasswordConfirmation($password, $confirmation);
355-
356352
$customer = $this->accountManagement
357353
->createAccount($customer, $password, $redirectUrl);
358354

@@ -362,12 +358,10 @@ public function execute()
362358
$customer->setExtensionAttributes($extensionAttributes);
363359
$this->customerRepository->save($customer);
364360
}
365-
366361
$this->_eventManager->dispatch(
367362
'customer_register_success',
368363
['account_controller' => $this, 'customer' => $customer]
369364
);
370-
371365
$confirmationStatus = $this->accountManagement->getConfirmationStatus($customer->getId());
372366
if ($confirmationStatus === AccountManagementInterface::ACCOUNT_CONFIRMATION_REQUIRED) {
373367
$email = $this->customerUrl->getEmailConfirmationUrl($customer->getEmail());

0 commit comments

Comments
 (0)