Skip to content

Commit 3cc3991

Browse files
wip44850glo74186
authored andcommitted
LYNX-397:Update Email Templates Links to Include Email Parameters
1 parent 67ba6dd commit 3cc3991

File tree

7 files changed

+22
-12
lines changed

7 files changed

+22
-12
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<!--@subject {{trans "Please confirm your %store_name account" store_name=$store.frontend_name}} @-->
88
<!--@vars {
99
"var store.frontend_name":"Store Name",
10-
"var this.getUrl($store,'customer/account/confirm/',[_query:[id:$customer.id,key:$customer.confirmation,back_url:$back_url],_nosid:1])":"Account Confirmation URL",
10+
"var this.getUrl($store,'customer/account/confirm/',[_query:[id:$customer.id,key:$customer.confirmation,back_url:$back_url,email:$customer.email],_nosid:1])":"Account Confirmation URL",
1111
"var this.getUrl($store, 'customer/account/')":"Customer Account URL",
1212
"var customer.email":"Customer Email",
1313
"var customer.name":"Customer Name"
@@ -24,7 +24,7 @@
2424
<table class="inner-wrapper" border="0" cellspacing="0" cellpadding="0" align="center">
2525
<tr>
2626
<td align="center">
27-
<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>
27+
<a href="{{var this.getUrl($store,'customer/account/confirm/',[_query:[id:$customer.id,key:$customer.confirmation,back_url:$back_url,email:$customer.email],_nosid:1])}}" target="_blank">{{trans "Confirm Your Account"}}</a>
2828
</td>
2929
</tr>
3030
</table>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<!--@vars {
99
"var store.frontend_name":"Store Name",
1010
"var this.getUrl($store, 'customer/account/')":"Customer Account URL",
11-
"var this.getUrl($store,'customer/account/createPassword',[_query:[id:$customer.id,token:$customer.rp_token],_nosid:1])":"Password Reset URL",
11+
"var this.getUrl($store,'customer/account/createPassword',[_query:[id:$customer.id,token:$customer.rp_token,email:$customer.email],_nosid:1])":"Password Reset URL",
1212
"var customer.name":"Customer Name"
1313
} @-->
1414
{{template config_path="design/email/header_template"}}
@@ -23,7 +23,7 @@
2323
<table class="inner-wrapper" border="0" cellspacing="0" cellpadding="0" align="center">
2424
<tr>
2525
<td align="center">
26-
<a href="{{var this.getUrl($store,'customer/account/createPassword',[_query:[id:$customer.id,token:$customer.rp_token],_nosid:1])}}" target="_blank">{{trans "Set a New Password"}}</a>
26+
<a href="{{var this.getUrl($store,'customer/account/createPassword',[_query:[id:$customer.id,token:$customer.rp_token,email:$customer.email],_nosid:1])}}" target="_blank">{{trans "Set a New Password"}}</a>
2727
</td>
2828
</tr>
2929
</table>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<!--@vars {
99
"var store.frontend_name":"Store Name",
1010
"var customer.name":"Customer Name",
11-
"var this.getUrl($store,'customer/account/createPassword/',[_query:[id:$customer.id,token:$customer.rp_token],_nosid:1])":"Reset Password URL"
11+
"var this.getUrl($store,'customer/account/createPassword/',[_query:[id:$customer.id,token:$customer.rp_token,email:$customer.email],_nosid:1])":"Reset Password URL"
1212
} @-->
1313
{{template config_path="design/email/header_template"}}
1414

@@ -22,7 +22,7 @@
2222
<table class="inner-wrapper" border="0" cellspacing="0" cellpadding="0" align="center">
2323
<tr>
2424
<td align="center">
25-
<a href="{{var this.getUrl($store,'customer/account/createPassword/',[_query:[id:$customer.id,token:$customer.rp_token],_nosid:1])}}" target="_blank">{{trans "Set a New Password"}}</a>
25+
<a href="{{var this.getUrl($store,'customer/account/createPassword/',[_query:[id:$customer.id,token:$customer.rp_token,email:$customer.email],_nosid:1])}}" target="_blank">{{trans "Set a New Password"}}</a>
2626
</td>
2727
</tr>
2828
</table>

dev/tests/integration/testsuite/Magento/Customer/Controller/Account/CreatePostTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,12 @@ public function testRegisterCustomerWithEmailConfirmation(): void
270270
$rawMessage
271271
);
272272
$this->assertStringContainsString(
273-
sprintf('customer/account/confirm/?id=%s&amp;key=%s', $customer->getId(), $confirmation),
273+
sprintf(
274+
'customer/account/confirm/?email=%s&amp;id=%s&amp;key=%s',
275+
urlencode($customer->getEmail()),
276+
$customer->getId(),
277+
$confirmation
278+
),
274279
$rawMessage
275280
);
276281
$this->resetRequest();

dev/tests/integration/testsuite/Magento/Customer/Controller/AccountTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ public function testResetPasswordWhenEmailChanged(): void
624624
$customerData = $customerRegistry->retrieveByEmail($email);
625625
$token = $customerData->getRpToken();
626626
$customerId = $customerData->getId();
627-
$this->assertForgotPasswordEmailContent($token, $customerId);
627+
$this->assertForgotPasswordEmailContent($token, $customerId, $email);
628628

629629
/* Set new email */
630630
/** @var CustomerRepositoryInterface $customerRepository */
@@ -701,13 +701,16 @@ private function dispatchLoginPostAction(string $email, string $password): void
701701
* Check that 'Forgot password' email contains correct data.
702702
*
703703
* @param string $token
704+
* @param int $customerId
705+
* @param string $email
704706
* @return void
705707
*/
706-
private function assertForgotPasswordEmailContent(string $token, int $customerId): void
708+
private function assertForgotPasswordEmailContent(string $token, int $customerId, string $email): void
707709
{
708710
$message = $this->transportBuilderMock->getSentMessage();
711+
$email = urlencode($email);
709712
//phpcs:ignore
710-
$pattern = "/<a.+customer\/account\/createPassword\/\?id={$customerId}&amp;token={$token}.+Set\s+a\s+New\s+Password<\/a\>/";
713+
$pattern = "/<a.+customer\/account\/createPassword\/\?email={$email}&amp;id={$customerId}&amp;token={$token}.+Set\s+a\s+New\s+Password<\/a\>/";
711714
$rawMessage = $message->getBody()->getParts()[0]->getRawContent();
712715
$messageConstraint = $this->logicalAnd(
713716
new StringContains('There was recently a request to change the password for your account.'),

dev/tests/integration/testsuite/Magento/Customer/Controller/ForgotPasswordPostTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,8 @@ private function clickForgotPasswordAndAssertResetLinkReceivedInMail($email): vo
491491
1,
492492
Xpath::getElementsCountForXpath(
493493
sprintf(
494-
'//a[contains(@href, \'customer/account/createPassword/?id=%1$d&token=%2$s\')]',
494+
'//a[contains(@href, \'customer/account/createPassword/?email=%1$s&id=%2$d&token=%3$s\')]',
495+
urlencode($customerData->getEmail()),
495496
$customerId,
496497
$token
497498
),

dev/tests/integration/testsuite/Magento/Customer/Model/AccountManagement/ResetPasswordTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ public function testSendEmailWithSetNewPasswordLink(): void
7373
1,
7474
Xpath::getElementsCountForXpath(
7575
sprintf(
76-
'//a[contains(@href, \'customer/account/createPassword/?id=%1$d&token=%2$s\')]',
76+
'//a[contains(@href, \'customer/account/createPassword/?email=%1$s&id=%2$d&token=%3$s\')]',
77+
urlencode($customerSecure->getEmail()),
7778
$customerSecure->getId(),
7879
$customerSecure->getRpToken()
7980
),

0 commit comments

Comments
 (0)