Skip to content

Commit 4d6552b

Browse files
authored
Merge pull request #18862 from mozilla/FXA-11049
feat(emails): Update postConsumeRecoveryCode email
2 parents a43392c + c5462d2 commit 4d6552b

19 files changed

Lines changed: 160 additions & 75 deletions

File tree

packages/fxa-auth-server/config/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2351,6 +2351,10 @@ convictConf.set(
23512351
'smtp.createAccountRecoveryUrl',
23522352
`${baseUri}/settings/account_recovery`
23532353
);
2354+
convictConf.set(
2355+
'smtp.manageTwoFactorSettingsUrl',
2356+
`${baseUri}/settings#two-step-authentication`
2357+
);
23542358
convictConf.set(
23552359
'smtp.verifyPrimaryEmailUrl',
23562360
`${baseUri}/verify_primary_email`

packages/fxa-auth-server/lib/routes/totp.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,6 @@ module.exports = (
434434
acceptLanguage,
435435
ip,
436436
location: geo.location,
437-
numberRemaining: remaining,
438437
timeZone: geo.timeZone,
439438
uaBrowser: ua.browser,
440439
uaBrowserVersion: ua.browserVersion,

packages/fxa-auth-server/lib/senders/email.js

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ module.exports = function (log, config, bounces, statsd) {
329329
this.subscriptionTermsUrl = mailerConfig.subscriptionTermsUrl;
330330
this.supportUrl = mailerConfig.supportUrl;
331331
this.syncUrl = mailerConfig.syncUrl;
332+
this.manageTwoFactorSettingsUrl = mailerConfig.manageTwoFactorSettingsUrl;
332333
this.unsubscribeUrl = mailerConfig.unsubscribeUrl;
333334
this.verificationUrl = mailerConfig.verificationUrl;
334335
this.verifyLoginUrl = mailerConfig.verifyLoginUrl;
@@ -355,6 +356,15 @@ module.exports = function (log, config, bounces, statsd) {
355356
);
356357
};
357358

359+
Mailer.prototype._twoFactorSettingsLinkAttributes = function (
360+
email,
361+
templateName
362+
) {
363+
return linkAttributes(
364+
this.createTwoFactorSettingsLink(email, templateName)
365+
);
366+
};
367+
358368
Mailer.prototype._passwordChangeLinkAttributes = function (
359369
email,
360370
templateName
@@ -1557,12 +1567,13 @@ module.exports = function (log, config, bounces, statsd) {
15571567
email: message.email,
15581568
iosLink: links.iosLink,
15591569
link: links.link,
1560-
numberRemaining: message.numberRemaining,
1561-
passwordChangeLink: links.passwordChangeLink,
1562-
passwordChangeLinkAttributes: links.passwordChangeLinkAttributes,
1570+
resetLink: links.resetLink,
1571+
resetLinkAttributes: links.resetLinkAttributes,
15631572
privacyUrl: links.privacyUrl,
15641573
supportLinkAttributes: links.supportLinkAttributes,
15651574
supportUrl: links.supportUrl,
1575+
twoFactorSettingsLink: links.twoFactorSettingsLink,
1576+
twoFactorSettingsLinkAttributes: links.twoFactorSettingsLinkAttributes,
15661577
time,
15671578
},
15681579
});
@@ -3043,6 +3054,7 @@ module.exports = function (log, config, bounces, statsd) {
30433054
templateName,
30443055
content
30453056
) {
3057+
console.log(link);
30463058
const parsedLink = new URL(link);
30473059

30483060
Object.keys(query).forEach((key) => {
@@ -3207,6 +3219,13 @@ module.exports = function (log, config, bounces, statsd) {
32073219
query.emailToHashWith
32083220
);
32093221

3222+
links['twoFactorSettingsLink'] = this.createTwoFactorSettingsLink(
3223+
email,
3224+
templateName
3225+
);
3226+
links['twoFactorSettingsLinkAttributes'] =
3227+
this._twoFactorSettingsLinkAttributes(email, templateName);
3228+
32103229
links['androidLink'] = this._generateUTMLink(
32113230
this.androidUrl,
32123231
query,
@@ -3371,11 +3390,8 @@ module.exports = function (log, config, bounces, statsd) {
33713390
templateName,
33723391
emailToHashWith
33733392
) {
3374-
// Default `reset_password_confirm` to false, to show warnings about
3375-
// resetting password and sync data
33763393
const query = {
33773394
email: email,
3378-
reset_password_confirm: false,
33793395
email_to_hash_with: emailToHashWith,
33803396
};
33813397

@@ -3398,6 +3414,20 @@ module.exports = function (log, config, bounces, statsd) {
33983414
);
33993415
};
34003416

3417+
Mailer.prototype.createTwoFactorSettingsLink = function (
3418+
email,
3419+
templateName
3420+
) {
3421+
const query = { email: email };
3422+
3423+
return this._generateUTMLink(
3424+
this.manageTwoFactorSettingsUrl,
3425+
query,
3426+
templateName,
3427+
'manage-two-factor'
3428+
);
3429+
};
3430+
34013431
Mailer.prototype.createReportSignInLink = function (templateName, data) {
34023432
const query = {
34033433
uid: data.uid,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
automated-email-change-plaintext-2 = "If you didn’t take this action, change your password right away:"
22
<%- passwordChangeLink %>
3+
34
automated-email-support-plaintext = "For more info, visit Mozilla Support:"
45
<%- supportUrl %>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
automated-email-reset-plaintext-v2 = "If you did not authorize this action, please reset your password now at <%- resetLink %>"
2+
3+
automated-email-support-plaintext = "For more info, visit Mozilla Support:"
4+
<%- supportUrl %>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This message is used by multiple automated emails that notify users of security events on their account
2+
# "this action" is meant to be a generic term, and could, for example, refer to using a backup authentication code to confirm a password reset
3+
automated-email-reset-pwd-two-factor = If you didnʼt take this action, then <a data-l10n-name="resetLink">reset your password</a> and <a data-l10n-name="twoFactorSettingsLink">reset two-step authentication</a> right away.
4+
For more information, please visit <a data-l10n-name="supportLink">{ -brand-mozilla } Support</a>.
5+
# Followed by link to https://accounts.firefox.com/reset_password
6+
automated-email-reset-pwd-plaintext-v3 = If you didnʼt take this action, then reset your password right away at:
7+
# Followed by link to https://accounts.firefox.com/settings#two-step-authentication
8+
automated-email-reset-two-factor-plaintext = Also, reset two-step authentication at:
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<%# This Source Code Form is subject to the terms of the Mozilla Public
2+
# License, v. 2.0. If a copy of the MPL was not distributed with this
3+
# file, You can obtain one at http://mozilla.org/MPL/2.0/. %>
4+
5+
<mj-section>
6+
<mj-column>
7+
<mj-text css-class="text-footer-automatedEmail">
8+
<span data-l10n-id="automated-email-reset-pwd-two-factor">
9+
If you didnʼt take this action, then
10+
<a class="link-blue" href="<%- resetLink %>" data-l10n-name="resetLink">reset your password</a> and
11+
<a class="link-blue" href="<%- twoFactorSettingsLink %>" data-l10n-name="twoFactorSettingsLink">reset two-step authentication</a> right away.
12+
For more information, please visit
13+
<a class="link-blue" href="<%- supportUrl %>" data-l10n-name="supportLink">Mozilla Support</a>.
14+
</span>
15+
</mj-text>
16+
</mj-column>
17+
</mj-section>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
* License, v. 2.0. If a copy of the MPL was not distributed with this
3+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4+
5+
import { Meta } from '@storybook/html';
6+
import { storyWithProps } from '../../storybook-email';
7+
8+
export default {
9+
title: 'Partials/footers/automatedEmailResetPasswordTwoFactor',
10+
} as Meta;
11+
12+
const createStory = storyWithProps(
13+
'_storybook',
14+
'This partial is used in footers for automated emails where password reset is recommended.',
15+
{
16+
layout: null,
17+
subject: 'N/A',
18+
partial: 'automatedEmailResetPasswordTwoFactor',
19+
resetLink: 'http://localhost:3030/reset_password',
20+
twoFactorSettingsLink:
21+
'http://localhost:3030/settings#two-step-authentication',
22+
}
23+
);
24+
25+
export const AutomatedEmailResetPassword = createStory();
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
automated-email-reset-pwd-plaintext-v3 = "If you didnʼt take this action, then reset your password right away at:"
2+
<%- resetLink %>
3+
4+
automated-email-reset-two-factor-plaintext = "Also, reset two-step authentication at:"
5+
<%- twoFactorSettingsLink %>
6+
7+
automated-email-support-plaintext = "For more info, visit Mozilla Support:"
8+
<%- supportUrl %>

packages/fxa-auth-server/lib/senders/emails/templates/_versions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"verifySecondaryCode": 3,
4242
"postAddTwoStepAuthentication": 9,
4343
"postRemoveTwoStepAuthentication": 9,
44-
"postConsumeRecoveryCode": 7,
44+
"postConsumeRecoveryCode": 8,
4545
"postNewRecoveryCodes": 7,
4646
"passwordResetAccountRecovery": 9,
4747
"postAddAccountRecovery": 9,

0 commit comments

Comments
 (0)