|
3 | 3 | * Copyright © Magento, Inc. All rights reserved.
|
4 | 4 | * See COPYING.txt for license details.
|
5 | 5 | */
|
| 6 | +declare(strict_types=1); |
| 7 | + |
6 | 8 | namespace Magento\Customer\Controller\Account;
|
7 | 9 |
|
8 | 10 | use Magento\Customer\Api\CustomerRepositoryInterface as CustomerRepository;
|
@@ -349,15 +351,14 @@ public function execute()
|
349 | 351 | $confirmation = $this->getRequest()->getParam('password_confirmation');
|
350 | 352 | $redirectUrl = $this->session->getBeforeAuthUrl();
|
351 | 353 | $this->checkPasswordConfirmation($password, $confirmation);
|
| 354 | + |
| 355 | + $extensionAttributes = $customer->getExtensionAttributes(); |
| 356 | + $extensionAttributes->setIsSubscribed($this->getRequest()->getParam('is_subscribed', false)); |
| 357 | + $customer->setExtensionAttributes($extensionAttributes); |
| 358 | + |
352 | 359 | $customer = $this->accountManagement
|
353 | 360 | ->createAccount($customer, $password, $redirectUrl);
|
354 | 361 |
|
355 |
| - if ($this->getRequest()->getParam('is_subscribed', false)) { |
356 |
| - $extensionAttributes = $customer->getExtensionAttributes(); |
357 |
| - $extensionAttributes->setIsSubscribed(true); |
358 |
| - $customer->setExtensionAttributes($extensionAttributes); |
359 |
| - $this->customerRepository->save($customer); |
360 |
| - } |
361 | 362 | $this->_eventManager->dispatch(
|
362 | 363 | 'customer_register_success',
|
363 | 364 | ['account_controller' => $this, 'customer' => $customer]
|
|
0 commit comments