Skip to content

Commit f3fccf7

Browse files
committed
Merge remote-tracking branch 'af/MC-13855' into MC-13852
2 parents d9028a0 + 3ebc299 commit f3fccf7

File tree

4 files changed

+14
-51
lines changed

4 files changed

+14
-51
lines changed

app/code/Magento/Customer/Api/AccountManagementInterface.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,13 @@ interface AccountManagementInterface
3131
* @param \Magento\Customer\Api\Data\CustomerInterface $customer
3232
* @param string $password
3333
* @param string $redirectUrl
34-
* @param string[] $extensions
3534
* @return \Magento\Customer\Api\Data\CustomerInterface
3635
* @throws \Magento\Framework\Exception\LocalizedException
3736
*/
3837
public function createAccount(
3938
\Magento\Customer\Api\Data\CustomerInterface $customer,
4039
$password = null,
41-
$redirectUrl = '',
42-
$extensions = []
40+
$redirectUrl = ''
4341
);
4442

4543
/**
@@ -50,7 +48,6 @@ public function createAccount(
5048
* @param string $hash Password hash that we can save directly
5149
* @param string $redirectUrl URL fed to welcome email templates. Can be used by templates to, for example, direct
5250
* the customer to a product they were looking at after pressing confirmation link.
53-
* @param string[] $extensions
5451
* @return \Magento\Customer\Api\Data\CustomerInterface
5552
* @throws \Magento\Framework\Exception\InputException If bad input is provided
5653
* @throws \Magento\Framework\Exception\State\InputMismatchException If the provided email is already used
@@ -59,8 +56,7 @@ public function createAccount(
5956
public function createAccountWithPasswordHash(
6057
\Magento\Customer\Api\Data\CustomerInterface $customer,
6158
$hash,
62-
$redirectUrl = '',
63-
$extensions = []
59+
$redirectUrl = ''
6460
);
6561

6662
/**

app/code/Magento/Customer/Model/AccountManagement.php

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,7 @@ public function getConfirmationStatus($customerId)
815815
/**
816816
* @inheritdoc
817817
*/
818-
public function createAccount(CustomerInterface $customer, $password = null, $redirectUrl = '', $extensions = [])
818+
public function createAccount(CustomerInterface $customer, $password = null, $redirectUrl = '')
819819
{
820820
if ($password !== null) {
821821
$this->checkPasswordStrength($password);
@@ -831,20 +831,16 @@ public function createAccount(CustomerInterface $customer, $password = null, $re
831831
} else {
832832
$hash = null;
833833
}
834-
return $this->createAccountWithPasswordHash($customer, $hash, $redirectUrl, $extensions);
834+
return $this->createAccountWithPasswordHash($customer, $hash, $redirectUrl);
835835
}
836836

837837
/**
838838
* @inheritdoc
839839
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
840840
* @SuppressWarnings(PHPMD.NPathComplexity)
841841
*/
842-
public function createAccountWithPasswordHash(
843-
CustomerInterface $customer,
844-
$hash,
845-
$redirectUrl = '',
846-
$extensions = []
847-
) {
842+
public function createAccountWithPasswordHash(CustomerInterface $customer, $hash, $redirectUrl = '')
843+
{
848844
// This logic allows an existing customer to be added to a different store. No new account is created.
849845
// The plan is to move this logic into a new method called something like 'registerAccountWithStore'
850846
if ($customer->getId()) {
@@ -917,7 +913,7 @@ public function createAccountWithPasswordHash(
917913
$customer = $this->customerRepository->getById($customer->getId());
918914
$newLinkToken = $this->mathRandom->getUniqueHash();
919915
$this->changeResetPasswordLinkToken($customer, $newLinkToken);
920-
$this->sendEmailConfirmation($customer, $redirectUrl, $extensions);
916+
$this->sendEmailConfirmation($customer, $redirectUrl);
921917

922918
return $customer;
923919
}
@@ -945,12 +941,11 @@ public function getDefaultShippingAddress($customerId)
945941
*
946942
* @param CustomerInterface $customer
947943
* @param string $redirectUrl
948-
* @param array $extensions
949944
* @return void
950945
* @throws LocalizedException
951946
* @throws NoSuchEntityException
952947
*/
953-
protected function sendEmailConfirmation(CustomerInterface $customer, $redirectUrl, $extensions = [])
948+
protected function sendEmailConfirmation(CustomerInterface $customer, $redirectUrl)
954949
{
955950
try {
956951
$hash = $this->customerRegistry->retrieveSecureData($customer->getId())->getPasswordHash();
@@ -960,14 +955,7 @@ protected function sendEmailConfirmation(CustomerInterface $customer, $redirectU
960955
} elseif ($hash == '') {
961956
$templateType = self::NEW_ACCOUNT_EMAIL_REGISTERED_NO_PASSWORD;
962957
}
963-
$this->getEmailNotification()->newAccount(
964-
$customer,
965-
$templateType,
966-
$redirectUrl,
967-
$customer->getStoreId(),
968-
null,
969-
$extensions
970-
);
958+
$this->getEmailNotification()->newAccount($customer, $templateType, $redirectUrl, $customer->getStoreId());
971959
} catch (MailException $e) {
972960
// If we are not able to send a new account email, this should be ignored
973961
$this->logger->critical($e);

app/code/Magento/Customer/Model/EmailNotification.php

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use Magento\Framework\Exception\LocalizedException;
1818

1919
/**
20-
* Class for notification customer.
20+
* Customer email notification
2121
*
2222
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2323
*/
@@ -65,8 +65,6 @@ class EmailNotification implements EmailNotificationInterface
6565
self::NEW_ACCOUNT_EMAIL_CONFIRMATION => self::XML_PATH_CONFIRM_EMAIL_TEMPLATE,
6666
];
6767

68-
const CUSTOMER_CONFIRM_URL = 'customer/account/confirm/';
69-
7068
/**#@-*/
7169

7270
/**#@-*/
@@ -366,7 +364,6 @@ public function passwordResetConfirmation(CustomerInterface $customer)
366364
* @param string $backUrl
367365
* @param string $storeId
368366
* @param string $sendemailStoreId
369-
* @param array $extensions
370367
* @return void
371368
* @throws LocalizedException
372369
*/
@@ -375,8 +372,7 @@ public function newAccount(
375372
$type = self::NEW_ACCOUNT_EMAIL_REGISTERED,
376373
$backUrl = '',
377374
$storeId = 0,
378-
$sendemailStoreId = null,
379-
$extensions = []
375+
$sendemailStoreId = null
380376
) {
381377
$types = self::TEMPLATE_TYPES;
382378

@@ -394,26 +390,11 @@ public function newAccount(
394390

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

397-
$templateVars = [
398-
'customer' => $customerEmailData,
399-
'back_url' => $backUrl,
400-
'store' => $store
401-
];
402-
if ($type == self::NEW_ACCOUNT_EMAIL_CONFIRMATION) {
403-
if (empty($extensions)) {
404-
$templateVars['url'] = self::CUSTOMER_CONFIRM_URL;
405-
$templateVars['extensions'] = $extensions;
406-
} else {
407-
$templateVars['url'] = $extensions['url'];
408-
$templateVars['extensions'] = $extensions['extension_info'];
409-
}
410-
}
411-
412393
$this->sendEmailTemplate(
413394
$customer,
414395
$types[$type],
415396
self::XML_PATH_REGISTER_EMAIL_IDENTITY,
416-
$templateVars,
397+
['customer' => $customerEmailData, 'back_url' => $backUrl, 'store' => $store],
417398
$storeId
418399
);
419400
}

app/code/Magento/Customer/view/frontend/email/account_new_confirmation.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99
"var this.getUrl($store, 'customer/account/confirm/', [_query:[id:$customer.id, key:$customer.confirmation, back_url:$back_url]])":"Account Confirmation URL",
1010
"var this.getUrl($store, 'customer/account/')":"Customer Account URL",
1111
"var customer.email":"Customer Email",
12-
"var customer.name":"Customer Name",
13-
"var extensions":"Extensions",
14-
"var url":"Url"
12+
"var customer.name":"Customer Name"
1513
} @-->
1614

1715
{{template config_path="design/email/header_template"}}
@@ -25,7 +23,7 @@
2523
<table class="inner-wrapper" border="0" cellspacing="0" cellpadding="0" align="center">
2624
<tr>
2725
<td align="center">
28-
<a href="{{var this.getUrl($store,$url,[_query:[id:$customer.id,key:$customer.confirmation,extensions:$extensions,back_url:$back_url],_nosid:1])}}" target="_blank">{{trans "Confirm Your Account"}}</a>
26+
<a href="{{var this.getUrl($store,'customer/account/confirm/',[_query:[id:$customer.id,key:$customer.confirmation,back_url:$back_url],_nosid:1])}}" target="_blank">{{trans "Confirm Your Account"}}</a>
2927
</td>
3028
</tr>
3129
</table>

0 commit comments

Comments
 (0)