This commit is contained in:
lesleyjanenorton 2019-06-24 13:38:59 -05:00
Родитель 68e471cc69
Коммит 0d416c48fc
4 изменённых файлов: 27 добавлений и 18 удалений

Просмотреть файл

@ -76,7 +76,7 @@ async function notify (req, res) {
log.info("notification", { length: recipients.length, breachAlertName: breachAlert.Name }); log.info("notification", { length: recipients.length, breachAlertName: breachAlert.Name });
const utmID = "breach-alert"; const utmID = "breach-alert";
const scanAnotherEmailHref = EmailUtils.getScanAnotherEmailUrl(utmID); const ctaHref = EmailUtils.getViewMyDashboardHref(utmID);
const notifiedRecipients = []; const notifiedRecipients = [];
for (const recipient of recipients) { for (const recipient of recipients) {
@ -101,9 +101,9 @@ async function notify (req, res) {
supportedLocales, supportedLocales,
breachAlert, breachAlert,
SERVER_URL: req.app.locals.SERVER_URL, SERVER_URL: req.app.locals.SERVER_URL,
scanAnotherEmailHref: scanAnotherEmailHref,
unsubscribeUrl: EmailUtils.getUnsubscribeUrl(recipient, utmID), unsubscribeUrl: EmailUtils.getUnsubscribeUrl(recipient, utmID),
whichView: "email_partials/report", ctaHref: ctaHref,
whichPartial: "email_partials/report",
}, },
); );
notifiedRecipients.push(breachedEmail); notifiedRecipients.push(breachedEmail);

Просмотреть файл

@ -92,11 +92,12 @@ async function confirmed(req, res, next, client = FxAOAuthClient) {
); );
const utmID = "report"; const utmID = "report";
const reportSubject = EmailUtils.getReportSubject(unsafeBreachesForEmail, req);
await EmailUtils.sendEmail( await EmailUtils.sendEmail(
email, email,
req.fluentFormat("user-verify-email-report-subject"), reportSubject,
"default_email", "default_email",
{ {
supportedLocales: req.supportedLocales, supportedLocales: req.supportedLocales,
@ -104,10 +105,9 @@ async function confirmed(req, res, next, client = FxAOAuthClient) {
recipientEmail: email, recipientEmail: email,
date: req.fluentFormat(new Date()), date: req.fluentFormat(new Date()),
unsafeBreachesForEmail: unsafeBreachesForEmail, unsafeBreachesForEmail: unsafeBreachesForEmail,
scanAnotherEmailHref: EmailUtils.getScanAnotherEmailUrl(utmID), ctaHref: EmailUtils.getViewMyDashboardHref(utmID),
unsubscribeUrl: EmailUtils.getUnsubscribeUrl(verifiedSubscriber, utmID), unsubscribeUrl: EmailUtils.getUnsubscribeUrl(verifiedSubscriber, utmID),
buttonValue: req.fluentFormat("report-scan-another-email"), whichPartial: "email_partials/report",
whichView: "email_partials/report",
} }
); );
req.session.user = verifiedSubscriber; req.session.user = verifiedSubscriber;

Просмотреть файл

@ -52,13 +52,13 @@ async function resendEmail(req, res) {
const email = unverifiedEmailAddressRecord.email; const email = unverifiedEmailAddressRecord.email;
await EmailUtils.sendEmail( await EmailUtils.sendEmail(
email, email,
req.fluentFormat("user-add-email-verify-subject"), req.fluentFormat("email-subject-verify"),
"default_email", "default_email",
{ recipientEmail: email, { recipientEmail: email,
supportedLocales: req.supportedLocales, supportedLocales: req.supportedLocales,
verificationHref: EmailUtils.getVerificationUrl(unverifiedEmailAddressRecord), ctaHref: EmailUtils.getVerificationUrl(unverifiedEmailAddressRecord),
unsubscribeUrl: EmailUtils.getUnsubscribeUrl(unverifiedEmailAddressRecord, "account-verification-email"), unsubscribeUrl: EmailUtils.getUnsubscribeUrl(unverifiedEmailAddressRecord, "account-verification-email"),
whichView: "email_partials/email_verify", whichPartial: "email_partials/email_verify",
} }
); );
@ -106,14 +106,14 @@ async function add(req, res) {
await EmailUtils.sendEmail( await EmailUtils.sendEmail(
email, email,
req.fluentFormat("user-add-email-verify-subject"), req.fluentFormat("email-subject-verify"),
"default_email", "default_email",
{ breachedEmail: email, { breachedEmail: email,
recipientEmail: email, recipientEmail: email,
supportedLocales: req.supportedLocales, supportedLocales: req.supportedLocales,
verificationHref: EmailUtils.getVerificationUrl(unverifiedSubscriber), ctaHref: EmailUtils.getVerificationUrl(unverifiedSubscriber),
unsubscribeUrl: EmailUtils.getUnsubscribeUrl(unverifiedSubscriber, "account-verification-email"), unsubscribeUrl: EmailUtils.getUnsubscribeUrl(unverifiedSubscriber, "account-verification-email"),
whichView: "email_partials/email_verify", whichPartial: "email_partials/email_verify",
} }
); );
@ -205,19 +205,21 @@ async function _verify(req) {
); );
const utmID = "report"; const utmID = "report";
const emailSubject = EmailUtils.getReportSubject(unsafeBreachesForEmail, req);
await EmailUtils.sendEmail( await EmailUtils.sendEmail(
verifiedEmailHash.email, verifiedEmailHash.email,
req.fluentFormat("user-verify-email-report-subject"), emailSubject,
"default_email", "default_email",
{ {
breachedEmail: verifiedEmailHash.email, breachedEmail: verifiedEmailHash.email,
recipientEmail: verifiedEmailHash.email, recipientEmail: verifiedEmailHash.email,
supportedLocales: req.supportedLocales, supportedLocales: req.supportedLocales,
unsafeBreachesForEmail: unsafeBreachesForEmail, unsafeBreachesForEmail: unsafeBreachesForEmail,
scanAnotherEmailHref: EmailUtils.getScanAnotherEmailUrl(utmID), ctaHref: EmailUtils.getViewMyDashboardHref(utmID),
unsubscribeUrl: EmailUtils.getUnsubscribeUrl(verifiedEmailHash, utmID), unsubscribeUrl: EmailUtils.getUnsubscribeUrl(verifiedEmailHash, utmID),
whichView: "email_partials/report", whichPartial: "email_partials/report",
} }
); );
} }

Просмотреть файл

@ -92,9 +92,16 @@ const EmailUtils = {
return url; return url;
}, },
getScanAnotherEmailUrl(emailType) { getReportSubject(breaches, req) {
if (breaches.length === 0) {
return req.fluentFormat("email-subject-no-breaches");
}
return req.fluentFormat("email-subject-found-breaches");
},
getViewMyDashboardHref(emailType) {
let url = new URL(AppConstants.SERVER_URL); let url = new URL(AppConstants.SERVER_URL);
url = this.appendUtmParams(url, "scan-another-email", emailType); url = this.appendUtmParams(url, "view-my-dashboard", emailType);
return url; return url;
}, },