delete pre-fxa and other obsolete code

This commit is contained in:
Amri Toufali 2022-09-14 23:08:22 -07:00
Родитель 599a556939
Коммит 39b3542410
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 75269D7487754F5D
13 изменённых файлов: 3 добавлений и 372 удалений

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

@ -2,7 +2,6 @@
const uuidv4 = require('uuid/v4')
const Knex = require('knex')
const { attachPaginate } = require('knex-paginate')
const { FluentError } = require('../locale-utils')
const AppConstants = require('../app-constants')
@ -14,7 +13,6 @@ const mozlog = require('../log')
const knexConfig = require('./knexfile')
let knex = Knex(knexConfig)
attachPaginate()
const log = mozlog('DB')
@ -78,12 +76,6 @@ const DB = {
return subscriberAndEmails
},
async getPreFxaSubscribersPage (pagination) {
return await knex('subscribers')
.whereRaw("(fxa_uid = '') IS NOT FALSE")
.paginate(pagination)
},
async getSubscriberByEmail (email) {
const [subscriber] = await knex('subscribers').where({
primary_email: email,

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

@ -78,58 +78,9 @@ email-breach-alert-blurb =
{-product-name} warns you about data breaches involving your personal info.
We just received details about another companys data breach.
# List headline
faq-list-headline = Frequently asked questions
# Link Title
faq-v2-1 = I dont recognize one of these companies or websites. Why am I in this breach?
# Link Title
faq-v2-2 = Do I need to do anything if a breach happened years ago or this is an old account?
# Link Title
faq-v2-3 = I just found out Im in a data breach. What do I do next?
# Link Title
faq-v2-4 = How does {-product-name} treat sensitive sites?
# This string contains nested markup that becomes a link to Firefox Monitor
# later in the code. Please do not modify or remove "<a>" and "</a>".
pre-fxa-message = <a>Create a free {-brand-fxa}</a>, and you can add up to 15 email addresses.
# Section headline
monitor-another-email = Want to monitor another email?
# Subject line of email
pre-fxa-subject = An update from {-product-name}
pre-fxa-headline = Whats changing with {-product-name}
pre-fxa-blurb = Heres whats changed since you signed up for {-product-name}, the service that
monitors known data breaches for your personal info. Were linking it to Firefox accounts.
pre-fxa-tout-1 = Stay alert to more breaches
pre-fxa-p-1 = <a>Create an account</a> to monitor up to 15 email address for
data breaches. We recommend adding any email addresses youve used to create online accounts.
pre-fxa-tout-2 = Get a dashboard view
pre-fxa-p-2 = See all data breaches in one place so you know which passwords to change.
The breach dashboard is only available with an account.
pre-fxa-tout-3 = Keep getting email alerts
pre-fxa-p-3 = Youll still receive alerts from {-product-name}. Well let you know if your info
appears in a new data breach.
# Button at the bottom of pre-fxa email.
create-account = Create Account
# More security products
more-products-headline = Protect yourself with more of our products
more-products-vpn = Protection for your whole device, on every device.
more-products-cta-vpn = Get {-product-name-vpn}
more-products-relay = Hide your real email address to help protect your identity.
more-products-cta-relay = Get {-product-name-relay}
## 2022 email template. HTML tags should not be translated, e.g. `<a>`
email-2022-unsubscribe = Youre receiving this automated email as a subscriber of { -product-name }. <br>Feel free to change your email preferences at any time <a { $unsubscribe-link-attr }>here</a>.

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

@ -1,68 +0,0 @@
'use strict'
/* eslint-disable no-process-env */
const { negotiateLanguages, acceptedLanguages } = require('fluent-langneg')
const AppConstants = require('../app-constants')
const DB = require('../db/DB')
const EmailHelpers = require('../template-helpers/emails.js')
const EmailUtils = require('../email-utils')
const { LocaleUtils } = require('../locale-utils')
const PAGE_SIZE = process.env.PAGE_SIZE
const START_PAGE = process.env.START_PAGE
if (!START_PAGE) {
console.error('You must provide a START_PAGE environment variable.')
process.exit()
}
(async (req) => {
const localeUtils = LocaleUtils.init()
EmailUtils.init()
const notifiedSubscribers = []
const utmID = 'pre-fxa'
const subscribersResult = await DB.getPreFxaSubscribersPage({ perPage: PAGE_SIZE, currentPage: START_PAGE, isLengthAware: true })
const numPagesToProcess = subscribersResult.pagination.lastPage - START_PAGE
console.log(`Found ${subscribersResult.pagination.total} subscriber records with empty fxa_uid.`)
console.log(`Will process ${numPagesToProcess} pages of size ${PAGE_SIZE}, starting with page ${START_PAGE} and ending with page ${subscribersResult.pagination.lastPage}.`)
const lastPage = subscribersResult.pagination.lastPage
for (let currentPage = START_PAGE; currentPage <= lastPage; currentPage++) {
console.log(`Processing page ${currentPage} of ${lastPage}.`)
const subscribersPageResult = await DB.getPreFxaSubscribersPage({ perPage: PAGE_SIZE, currentPage })
for (const subscriber of subscribersPageResult.data) {
const signupLanguage = subscriber.signup_language
const subscriberEmail = subscriber.primary_email
const requestedLanguage = signupLanguage ? acceptedLanguages(signupLanguage) : ''
const supportedLocales = negotiateLanguages(
requestedLanguage,
localeUtils.availableLanguages,
{ defaultLocale: 'en' }
)
if (!notifiedSubscribers.includes(subscriberEmail)) {
const sendInfo = await EmailUtils.sendEmail(
subscriberEmail,
LocaleUtils.fluentFormat(supportedLocales, 'pre-fxa-subject'), // email subject
'default_email', // email template
{
supportedLocales,
SERVER_URL: AppConstants.SERVER_URL,
unsubscribeUrl: EmailUtils.getUnsubscribeUrl(subscriber, utmID), // need to test the flow for legacy users who want to unsubscribe
ctaHref: EmailHelpers.getPreFxaUtmParams(AppConstants.SERVER_URL, 'create-account-button', subscriberEmail),
whichPartial: 'email_partials/pre-fxa',
preFxaEmail: true,
email: subscriberEmail
}
)
notifiedSubscribers.push(subscriberEmail)
console.log(`Sent email to ${subscriberEmail}, info: ${JSON.stringify(sendInfo)}`)
}
}
}
console.log(`Notified subscribers: ${JSON.stringify(notifiedSubscribers)}`)
process.exit()
})()

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

@ -28,59 +28,12 @@ function emailBreachStats (args) {
statTitle: LocaleUtils.fluentFormat(locales, 'passwords-exposed', { passwords: numPasswordsExposed })
}
}
if (userBreaches.length === 0) delete emailBreachStats.numPasswords // if user has no breaches, do not show passwords exposed stat
return emailBreachStats
}
function getPreFxaUtmParams (serverUrl, content, userEmail) {
const url = new URL(`${serverUrl}/oauth/init`)
const utmParams = {
utm_source: 'fx-monitor',
utm_medium: 'fx-monitor-email',
utm_content: content,
utm_campaign: 'pre-fxa-subscribers',
email: userEmail
}
for (const param in utmParams) {
url.searchParams.append(param, utmParams[param])
}
return url
}
function getPreFxaTouts (args) {
const locales = args.data.root.supportedLocales
const serverUrl = args.data.root.SERVER_URL
const userEmail = args.data.root.email
const fxaTouts = [
{
imgSrc: `${serverUrl}/img/email_images/pictogram-alert.png`,
headline: LocaleUtils.fluentFormat(locales, 'pre-fxa-tout-1'),
paragraph: LocaleUtils.fluentFormat(locales, 'pre-fxa-p-1')
},
{
imgSrc: `${serverUrl}/img/email_images/pictogram-advice.png`,
headline: LocaleUtils.fluentFormat(locales, 'pre-fxa-tout-2'),
paragraph: LocaleUtils.fluentFormat(locales, 'pre-fxa-p-2')
},
{
imgSrc: `${serverUrl}/img/email_images/pictogram-email.png`,
headline: LocaleUtils.fluentFormat(locales, 'pre-fxa-tout-3'),
paragraph: LocaleUtils.fluentFormat(locales, 'pre-fxa-p-3')
}
]
// replace placeholder anchor tag markup in first tout to make link
// add UTM params which are passed to FxA for account creation
const fxaTout1 = fxaTouts[0].paragraph
const url = getPreFxaUtmParams(serverUrl, 'create-account-link', userEmail)
if ((/<a>/).test(fxaTout1) && (/<\/a>/).test(fxaTout1)) {
const openingAnchorTag = `<a class="pre-fxa-nested-link" href="${url}" style="color: #0060df; font-family: sans-serif; font-weight: 300; font-size: 15px; text-decoration: none;">`
fxaTouts[0].paragraph = fxaTout1.replace('<a>', openingAnchorTag)
}
return fxaTouts
}
function getUnsafeBreachesForEmailReport (args) {
const locales = args.data.root.supportedLocales
const foundBreaches = JSON.parse(JSON.stringify(args.data.root.unsafeBreachesForEmail))
@ -112,10 +65,6 @@ function getEmailHeader (args) {
return LocaleUtils.fluentFormat(locales, 'email-link-expires')
}
if (emailType === 'email_partials/pre-fxa') {
return LocaleUtils.fluentFormat(locales, 'pre-fxa-headline')
}
if (args.data.root.breachAlert) {
return LocaleUtils.fluentFormat(locales, 'email-alert-hl', { userEmail: boldVioletText(breachedEmail, true) })
}
@ -143,28 +92,6 @@ function makeFaqLink (target, campaign) {
return url
}
function makePreFxaSubscriberMessage (args) {
const serverUrl = args.data.root.SERVER_URL
const locales = args.data.root.supportedLocales
const url = new URL(`${serverUrl}/#fx-account-features`)
const utmParameters = {
utm_source: 'fx-monitor',
utm_medium: 'email',
utm_content: 'breach-alert',
utm_campaign: 'pre-fxa-subscribers'
}
for (const param in utmParameters) {
url.searchParams.append(param, utmParameters[param])
}
let preFxaMessage = LocaleUtils.fluentFormat(locales, 'pre-fxa-message')
if ((/<a>/).test(preFxaMessage) && (/<\/a>/).test(preFxaMessage)) {
const openingAnchorTag = `<a class="pre-fxa-nested-link" href="${url}" style="color: #0060df; font-family: sans-serif; font-weight: 400; font-size: 16px; text-decoration: none;">`
preFxaMessage = preFxaMessage.replace('<a>', openingAnchorTag)
}
return preFxaMessage
}
function getBreachAlertFaqs (args) {
const supportedLocales = args.data.root.supportedLocales
const faqs = [
@ -304,13 +231,10 @@ module.exports = {
getEmailHeader,
getEmailFooterCopy,
getEmailCTA,
getPreFxaTouts,
getPreFxaUtmParams,
getReportHeader,
getServerUrlForNestedEmailPartial,
getUnsafeBreachesForEmailReport,
ifPreFxaSubscriber,
makePreFxaSubscriberMessage,
showFaqs,
showProducts
}

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

@ -1,10 +0,0 @@
<table class="breach-stat" width="100%" border="0" cellpadding="0" cellspacing="0" style="background-color: #f0f0f4; border-radius: 10px; padding: 20px;">
<tr>
<td class="breach-stat-number-wrap" valign="center" align="center" style="text-align: center; width: 70px;">
<p class="breach-stat-number" style="color: #20123a; font-size: 35px; font-family: sans-serif; font-weight: 600; margin: 0;">{{ statNumber }}</p>
</td>
<td valign="center" style="text-align: left; padding: 0 20px;">
<p class="breach-stat-title" style="color: #42425a; font-size: 16px; line-height: 1.5; font-family: sans-serif; font-weight: 400; margin: 0; padding: 0;">{{ statTitle }}</p>
</td>
</tr>
</table>

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

@ -1,16 +0,0 @@
<table align="center" class="email-button-table" align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width: 400px;" >
<tr>
<td>
<table align="center" width="100%">
<tr>
<td width="100%" class="email-button-wrapper" align="center" bgcolor="#0060df" style="width: 100%; border-radius: 8px; font-family: sans-serif;">
<a class="email-button" href="{{ href }}" rel="noopener" style="text-align: center; text-decoration: none; color: #ffffff; padding-top: 12px; padding-right: 30px; padding-left: 30px; padding-bottom: 12px; display: inline-block; font-size: 15px; box-sizing: border-box; width: 100%;">
{{ getEmailCTA }}
</a>
</td>
</tr>
</table>
</td>
</tr>
</table>

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

@ -1,13 +0,0 @@
<table class="source-info-wrap" style="text-align: center; width: 100%;" width="100%">
<tr>
<td align="center" style="font-family: sans-serif; text-align: center;">
{{#if breachAlert.IsSensitive}}
<p class="source-info email-small-text" style="font-size: 15px; font-weight: 300; font-family: sans-serif; margin: 0; line-height: 1.5; padding-bottom: 10px;">
{{ getString "email-sensitive-disclaimer" }}
</p>
{{/if}}
<p class="source-info email-small-text" style="color: #5e5e72; padding: 0; margin: 0; font-size: 13px; line-height: 1.5; font-weight: 300; font-family: sans-serif;">{{{ getString "learn-more-about-fxm" fxmLink='<a style="color: #0060df; font-weight: 400;" href="https://monitor.firefox.com/?utm_source=fx-monitor&utm_medium=email&utm_campaign=learn-more-link" target="_blank" rel="noopener noreferrer">Firefox Monitor</a>'}}}</p>
<p class="source-info email-small-text" style="color: #5e5e72; padding: 0; margin: 0; font-size: 13px; line-height: 1.5; font-weight: 300; font-family: sans-serif;">{{{ getString "hibp-attribution" hibp-link='<a id="hibp-link" style="color: #0060df; font-weight: 400;" href="https://www.haveibeenpwned.com" target="_blank" rel="noopener noreferrer">Have I Been Pwned</a>' }}}</p>
</td>
</tr>
</table>

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

@ -1,32 +0,0 @@
<table style="padding: 30px 0 0 0;">
{{#ifPreFxaSubscriber }}
<tr align="center" class="pre-fxa-subscriber-message email-faq" style="text-align: center;">
<td colspan="2" valign="top"
style="padding-bottom: 32px; padding-top: 32px; text-align: center; border-bottom: 1px solid #eee;">
<img src="{{ getServerUrlForNestedEmailPartial }}/img/email_images/pictogram-email.png" width="100" alt="" aria-hidden="true"/>
<p class="pre-fxa-headline" style="font-size: 20px; font-weight: 700; padding-top: 16px; margin: 0 auto; color: #20123a">{{ getString "monitor-another-email" }}{{ serverUrl }}</p>
<p class="pre-fxa-subhead" style="max-width: 310px; color: #0c0c0d; font-weight: 400; font-size: 16px; margin: auto;">{{{ makePreFxaSubscriberMessage }}}</p>
</td>
</tr>
{{/ifPreFxaSubscriber}}
<tr class="email-faq">
<td colspan="2" valign="top" style="padding-bottom: 20px;">
<p class="faq-header"
style="color: #20123a; font-family: sans-serif; font-weight: 400; font-size: 19px; margin: 0px; text-align: center;">
{{ getString "faq-list-headline" }}
</p>
</td>
</tr>
{{#getBreachAlertFaqs}}
<tr>
<td class="email-faq-bullet" valign="top" width="10px" style="padding-bottom: 4px;">
<p style="margin: 0; padding: 0; font-size: 20px; font-weight: 700; color: #20123a; font-family: sans-serif; line-height: 1;">&bull;</p>
</td>
<td class="email-faq-link" valign="top" align="center" style="text-align: left; padding-bottom: 4px;">
<a href="{{ href }}" class="faq-link body-copy" style="color: #0060df; font-family: sans-serif; font-weight: 400; font-size: 16px; display: inline-block; margin: 0px; text-decoration: none; line-height: 1.5;">
{{ linkTitle }}
</a>
</td>
</tr>
{{/getBreachAlertFaqs}}
</table>

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

@ -1,24 +0,0 @@
<table width="100%" class="footer" align="center" border="0" cellspacing="0" cellpadding="0" style="text-align: center; width: 100%;">
<tr>
<td align="center" style="padding-bottom: 30px; max-width: 400px;">
<p class="email-small-text unsub-disclaimer" style="margin: 0px; font-weight: 300; font-family: sans-serif; color: #5e5e72; max-width: 400px; line-height: 1.5; font-size: 13px;">
{{{ getEmailFooterCopy }}}
</p>
</td>
</tr>
<tr>
<td class="footer-border-top" width="100%" align="center" style="margin:0px; width: 100%; border-top: 1px solid #eee; padding-top: 40px; padding-bottom: 10px; width: 100%;">
<a rel="noopener" href="https://www.mozilla.org/{{> email_partials/utm_email_footer }}" style="margin: 0px; padding: 0px;">
<img src="{{ SERVER_URL }}/img/email_images/mozilla-logo-bw-rgb.png" width="130px" style="width: 130px;" />
</a>
</td>
</tr>
<tr>
<td valign="top">
<p class="email-small-text" style="padding: 0px 0px 10px 0px; margin: 0px; font-weight: 300; color: #5e5e72; font-family: sans-serif; font-size: 13px;">2 Harrison St. #175, San Francisco, California 94105 USA</p>
<p class="email-small-text" style="padding: 0px; margin: 0px; font-size: 13px;">
<a class="footer-link" href="https://www.mozilla.org/about/legal/{{> email_partials/utm_email_footer }}" rel="noopener" style="color: #0060df; font-family: sans-serif;">{{ getString "legal" }}</a><span style="color:#5e5e72;"> &#8226;</span> <a class="footer-link" href="https://www.mozilla.org/privacy/firefox-monitor/{{> email_partials/utm_email_footer }}" rel="noopener" style="color: #0060df; font-family: sans-serif;">{{ getString "terms-and-privacy" }}</a>
</p>
</td>
</tr>
</table>

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

@ -1,24 +0,0 @@
<table cellpadding="8"
style="margin-top: 32px; padding-bottom:32px; border-bottom:1px solid #eee; font: 15px/1.2 sans-serif; text-align:left">
<caption style="font-size: 19px">{{ getString "more-products-headline" }}</caption>
<tr>
<td align="center" border="0">
<img align="center" src="{{ @root.SERVER_URL }}/img/email_images/products-vpn.png" width="201" height="201"
style="width:100px; height:auto">
</td>
<td>{{ getString "more-products-vpn" }} <br><a
href="https://www.mozilla.org/products/vpn/?utm_source=firefox-monitor&utm_medium=email&utm_campaign={{this.strings.campaign}}"
style="display:block; color: #0250bb; margin-top: 8px; text-decoration:none">{{ getString
"more-products-cta-vpn" }}</a></td>
</tr>
<tr>
<td align="center" border="0">
<img align="center" src="{{ @root.SERVER_URL }}/img/email_images/products-relay.png" width="220"
height="142" style="width:100px; height:auto">
</td>
<td>{{ getString "more-products-relay" }} <br><a
href="https://relay.firefox.com/?utm_source=firefox-monitor&utm_medium=email&utm_campaign={{this.strings.campaign}}"
style="display:block; color: #0250bb; margin-top: 8px; text-decoration:none">{{ getString
"more-products-cta-relay" }}</a></td>
</tr>
</table>

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

@ -1,16 +0,0 @@
<table alig="center" bgcolor="#ffffff" width="400px" class="email-breach-listing drop-shadow {{#if breachAlert}} alert-red-border {{/if}}" border-collapse="collapse" style="overflow: hidden; {{#if breachAlert}} border-color: #ff4f5e; border-style: solid; border-width: 2px; {{/if}} text-align: left; background-color: rgba(255, 255, 255, 1); padding: 20px; border-radius: 10px; box-shadow: 0 0 1px 1px rgba(96, 125, 139, 0.03), 1px 1px 10px rgba(67, 65, 87, 0.1); max-width: 400px;">
<tr>
<td class="email-breach-image" valign="top" style="padding-bottom: 10px; width: 40px;">
<img class="breach-logo" src="{{ LogoUrl }}" width="25" style="width: 25px" />
</td>
<td valign="top" style="vertical-align: top; font-family: sans-serif; width: 100%; padding-left: 20px;">
<p class="text-bold" style="font-weight: 700; font-size: 17px; font-family: sans-serif; padding-bottom: 10px; margin: 0; color: #20123a;">{{ Title }}</p>
<p class="text-light" style="font-weight: 300; color: #5e5e72; font-size: 13px; font-family: sans-serif; margin: 0px; padding-bottom: 4px;">{{ LocalizedBreachCardStrings.BreachAdded }}</p>
<p class="text-medium" style="font-weight: 600; color: #20123a; font-size: 15px; padding-bottom: 15px; font-family: sans-serif; margin: 0px;">{{ AddedDate }}</p>
{{#if DataClasses }}
<p class="text-light" style="font-weight: 300; color: #5e5e72; font-size: 13px; font-family: sans-serif; margin: 0px; padding-bottom: 4px;">{{ LocalizedBreachCardStrings.CompromisedData }}</p>
<span class="text-medium" style="font-weight:600; font-size: 15px; font-family: sans-serif; margin: 0px; color: #20123a;">{{ DataClasses }}</span>
{{/if}}
</td>
</tr>
</table>

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

@ -1,32 +0,0 @@
<table align="center" width="100%" style="max-width: 330px;">
<tr>
<td align="center">
<h2 class="email-hl" align="center" style="color: #20123a; font-size: 24px; text-align: center; line-height: 1.25; margin: auto; font-family: sans-serif;">
{{{ getEmailHeader }}}
</h2>
</td>
</tr>
</table>
<table align="center" width="100%" style="max-width: 400px;">
<tr>
<td align="center">
<p class="email-subhead" style="color: #0c0c0d; font-size: 16px; font-weight: 300; font-family: sans-serif; text-align: center; margin: 0; padding: 0 0 40px 0; line-height: 1.5;">
{{ getString "pre-fxa-blurb" }}
</p>
</td>
</tr>
</table>
{{#each (getPreFxaTouts)}}
<table class="pre-fxa-tout" align="center" width="100%" style="max-width: 320px; padding-bottom: 40px;">
<tr>
<td align="center" style="max-width: 320px;">
<img src="{{ imgSrc }}" class="pre-fxa-icon" alt="" align="center" style="max-width: 90px;" />
<h2 style="color: rgb(32, 18, 58); font-size: 20px; font-weight: 700;font-family: sans-serif; line-height: 1.4; padding-bottom: 4px; padding-top: 12px; margin-bottom: 0; margin-top: 0;">{{headline}}</h2>
<p style="color: #0c0c0d; font-size: 15px; font-weight: 300; font-family: sans-serif; line-height: 1.5; text-align: center; margin: 0; padding: 0; line-height: 1.5;">
{{{ paragraph }}}
</p>
</td>
</tr>
</table>
{{/each}}

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

@ -1 +0,0 @@
?utm_source=email&utm_medium=email&utm_campaign=fx_monitor_downloads&utm_content=email-footer-link