Merge pull request #245 from mozilla/i183
fix(templates): remove suspicious_location template
This commit is contained in:
Коммит
dd8b653d97
42
mailer.js
42
mailer.js
|
@ -22,7 +22,6 @@ module.exports = function (log) {
|
|||
'passwordResetEmail': 'password-reset-success',
|
||||
'postVerifyEmail': 'account-verified',
|
||||
'recoveryEmail': 'forgot-password',
|
||||
'suspiciousLocationEmail': 'suspicious-location',
|
||||
'unblockCode': 'new-unblock',
|
||||
'verifyEmail': 'welcome',
|
||||
'verifyLoginEmail': 'new-signin',
|
||||
|
@ -41,7 +40,6 @@ module.exports = function (log) {
|
|||
'passwordResetRequiredEmail': 'password-reset',
|
||||
'postVerifyEmail': 'connect-device',
|
||||
'recoveryEmail': 'reset-password',
|
||||
'suspiciousLocationEmail': 'password-reset',
|
||||
'unblockCode': 'unblock-code',
|
||||
'verificationReminderFirstEmail': 'activate',
|
||||
'verificationReminderSecondEmail': 'activate',
|
||||
|
@ -613,46 +611,6 @@ module.exports = function (log) {
|
|||
})
|
||||
}
|
||||
|
||||
Mailer.prototype.suspiciousLocationEmail = function (message) {
|
||||
log.trace({ op: 'mailer.suspiciousLocationEmail', email: message.email, uid: message.uid })
|
||||
|
||||
var templateName = 'suspiciousLocationEmail'
|
||||
var links = this._generateLinks(this.initiatePasswordResetUrl, message.email, {}, templateName)
|
||||
|
||||
// the helper function `t` references `this.translator`. Because of
|
||||
// the way Handlebars `each` loops work, a translator instance must be
|
||||
// added to each entry or else no translator is available when translating
|
||||
// the entry.
|
||||
var translator = this.translator(message.acceptLanguage)
|
||||
|
||||
message.locations.forEach(function (entry) {
|
||||
entry.translator = translator
|
||||
})
|
||||
|
||||
var headers = {
|
||||
'X-Link': links.resetLink
|
||||
}
|
||||
|
||||
if (message.flowBeginTime && message.flowId) {
|
||||
headers['X-Flow-Id'] = message.flowId
|
||||
headers['X-Flow-Begin-Time'] = message.flowBeginTime
|
||||
}
|
||||
|
||||
return this.send({
|
||||
acceptLanguage: message.acceptLanguage,
|
||||
email: message.email,
|
||||
headers: headers,
|
||||
subject: gettext('Suspicious activity with your Firefox Account'),
|
||||
template: templateName,
|
||||
templateValues: {
|
||||
passwordManagerInfoUrl: links.passwordManagerInfoUrl,
|
||||
privacyUrl: links.privacyUrl,
|
||||
locations: message.locations,
|
||||
resetLink: links.resetLink
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Mailer.prototype.verificationReminderEmail = function (message) {
|
||||
log.trace({ op: 'mailer.verificationReminderEmail', email: message.email, type: message.type })
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
* passwordResetRequiredEmail
|
||||
* postVerifyEmail
|
||||
* recoveryEmail
|
||||
* suspiciousLocationEmail
|
||||
* unblockCodeEmail
|
||||
* verificationReminderEmail:first
|
||||
* verificationReminderEmail:second
|
||||
|
|
|
@ -54,7 +54,6 @@ module.exports = function () {
|
|||
'password_reset_required',
|
||||
'post_verify',
|
||||
'recovery',
|
||||
'suspicious_location',
|
||||
'unblock_code',
|
||||
'verification_reminder_first',
|
||||
'verification_reminder_second',
|
||||
|
|
|
@ -1,118 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<title>{{t "Firefox Accounts"}}</title>
|
||||
<style type="text/css">
|
||||
@media only screen and (max-width: 480px) {
|
||||
div[class="mobiledevicesupport"] table.container {
|
||||
width: 320px !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<div class="mobiledevicesupport">
|
||||
<body style="-ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; margin: 0; padding: 0;">
|
||||
<table align="center" border="0" cellpadding="0" cellspacing="0" width="600" style="-webkit-text-size-adjust: 100%; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 600px; margin: 0 auto;" class="container">
|
||||
|
||||
<!--Logo-->
|
||||
<tr style="page-break-before: always">
|
||||
<td align="center" id="firefox-logo" style="padding: 20px 0;">
|
||||
<img src="http://image.e.mozilla.org/lib/fe9915707361037e75/m/2/fxlogojg.gif" height="95" width="88" alt="" style="-ms-interpolation-mode: bicubic;" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!--Header Area-->
|
||||
<tr style="page-break-before: always">
|
||||
<td valign="top">
|
||||
<p class="primary" style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0 0 24px 0; text-align: left;">
|
||||
{{t "Did you sign in to your Firefox Account from any of the following locations in the last 60 days? If you don’t recognize these locations, someone else may have accessed your Firefox Account."}}
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{{#each locations}}
|
||||
<tr style="page-break-before: always">
|
||||
<td valign="top">
|
||||
<p class="primary" style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0 0 10px 0; text-align: center;">{{t "Date & Time:" }} {{ timestamp }} </p>
|
||||
<p class="primary" style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0 0 10px 0; text-align: center;">{{t "Device:" }} {{ device }}</p>
|
||||
<p class="primary" style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0 0 24px 0; text-align: center;">{{t "Location:" }} {{ location }}</p>
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
|
||||
<tr style="page-break-before: always">
|
||||
<td valign="top">
|
||||
<p style="font-family: sans-serif; font-size: 14px; font-weight: bold; margin: 0 0 0 0; text-align: left;">{{t "If you don’t recognize the activity above:" }}</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr style="page-break-before: always">
|
||||
<td valign="top">
|
||||
<ul>
|
||||
<li style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0 0 10px 0; text-align: left;">
|
||||
<a style="color: #0996f8; text-decoration: none; font-family: sans-serif;" href="{{{ resetLink }}}">{{t "First, change your Firefox Account password."}}</a>
|
||||
</li>
|
||||
<li style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0 0 10px 0; text-align: left;">
|
||||
{{t "Second, if Firefox stores passwords to websites, you should change those passwords as well. Attackers may have access to those passwords, so you should check those accounts for suspicious activity."}} <a href="{{{passwordManagerInfoUrl}}}" style="color: #0996f8; text-decoration: none; font-family: sans-serif;">{{t "Learn how to see what passwords Firefox is storing for you." }}</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr style="page-break-before: always">
|
||||
<td valign="top">
|
||||
<p style="font-family: sans-serif; font-size: 14px; font-weight: bold; margin: 10px 0 10px 0; text-align: left;">{{t "Why are you receiving this email?" }}</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr style="page-break-before: always">
|
||||
<td valign="top">
|
||||
<p style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0 0 30px 0; text-align: left;">{{t "We recently noticed Firefox Account logins from unusual locations. We’re notifying you as a precaution."}}
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr style="page-break-before: always">
|
||||
<td valign="top">
|
||||
<p style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0 0 10px 0; text-align: left;">{{t "Best,"}}
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr style="page-break-before: always">
|
||||
<td valign="top">
|
||||
<p style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0 0 40px 0; text-align: left;">{{t "The Firefox Accounts team"}}
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr style="page-break-before: always">
|
||||
<td valign="top">
|
||||
<p style="font-family: sans-serif; font-size: 14px; font-weight: bold; margin: 0 0 0 0; text-align: left;">Mozilla
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr style="page-break-before: always">
|
||||
<td valign="top">
|
||||
<p style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0 0 10px 0; text-align: left;">331 E. Evelyn Avenue Mountain View, CA 94041
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr style="page-break-before: always">
|
||||
<td valign="top">
|
||||
<p style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0 0 0 0; text-align: left;"><a href="{{{privacyUrl}}}" style="color: #0996f8; text-decoration: none; font-family: sans-serif;">{{t "Mozilla Privacy Policy" }}</a>
|
||||
<br /><br />
|
||||
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
|
@ -1,21 +0,0 @@
|
|||
{{{t "Did you sign in to your Firefox Account from any of the following locations in the last 60 days? If you don’t recognize these locations, someone else may have accessed your Firefox Account."}}}
|
||||
{{#each locations}}
|
||||
|
||||
{{{t "Date & Time:" }}} {{ timestamp }}
|
||||
{{{t "Device:" }}} {{ device }}
|
||||
{{{t "Location:" }}} {{ location }}
|
||||
{{/each}}
|
||||
|
||||
{{{t "If you don’t recognize the activity above:" }}}
|
||||
{{{t "First, change your Firefox Account password."}}} {{{ resetLink }}}
|
||||
|
||||
{{{t "Second, if Firefox stores passwords to websites, you should change those passwords as well. Attackers may have access to those passwords, so you should check those accounts for suspicious activity." }}} {{{t "Learn how to see what passwords Firefox is storing for you."}}} {{{passwordManagerInfoUrl}}}
|
||||
|
||||
{{{t "Why are you receiving this email?" }}}
|
||||
{{{t "We recently noticed Firefox Account logins from unusual locations. We’re notifying you as a precaution." }}}
|
||||
|
||||
{{{t "Best," }}}
|
||||
{{{t "The Firefox Accounts team" }}}
|
||||
|
||||
Mozilla. 331 E Evelyn Ave, Mountain View, CA 94041
|
||||
{{t "Mozilla Privacy Policy" }} {{{privacyUrl}}}
|
|
@ -24,7 +24,6 @@ var messageTypes = [
|
|||
'passwordResetRequiredEmail',
|
||||
'postVerifyEmail',
|
||||
'recoveryEmail',
|
||||
'suspiciousLocationEmail',
|
||||
'unblockCodeEmail',
|
||||
'verificationReminderEmail',
|
||||
'verifyEmail',
|
||||
|
@ -45,7 +44,6 @@ var typesContainPasswordResetLinks = [
|
|||
'passwordChangedEmail',
|
||||
'passwordResetEmail',
|
||||
'passwordResetRequiredEmail',
|
||||
'suspiciousLocationEmail'
|
||||
]
|
||||
|
||||
var typesContainPasswordChangeLinks = [
|
||||
|
@ -80,7 +78,6 @@ var typesContainLocationData = [
|
|||
|
||||
var typesContainPasswordManagerInfoLinks = [
|
||||
'passwordResetRequiredEmail',
|
||||
'suspiciousLocationEmail'
|
||||
]
|
||||
|
||||
function includes(haystack, needle) {
|
||||
|
@ -424,44 +421,6 @@ P.all(
|
|||
mailer[type](message)
|
||||
}
|
||||
)
|
||||
} else if (type === 'suspiciousLocationEmail') {
|
||||
var locations = [
|
||||
{
|
||||
device: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:48.0) Gecko/20100101 Firefox/48.0',
|
||||
location: 'Mountain View, CA',
|
||||
timestamp: (new Date()).toString()
|
||||
},
|
||||
{
|
||||
device: 'MSIE 10',
|
||||
location: 'London, United Kingdom',
|
||||
timestamp: (new Date()).toString()
|
||||
}
|
||||
]
|
||||
|
||||
message = {
|
||||
email: 'a@b.com',
|
||||
locations: locations
|
||||
}
|
||||
|
||||
test(
|
||||
'test suspicious location entries are added for ' + type,
|
||||
function (t) {
|
||||
mailer.mailer.sendMail = function (emailConfig) {
|
||||
locations.forEach(function (location) {
|
||||
t.ok(includes(emailConfig.html, location.device))
|
||||
t.ok(includes(emailConfig.html, location.location))
|
||||
t.ok(includes(emailConfig.html, location.timestamp))
|
||||
|
||||
t.ok(includes(emailConfig.text, location.device))
|
||||
t.ok(includes(emailConfig.text, location.location))
|
||||
t.ok(includes(emailConfig.text, location.timestamp))
|
||||
})
|
||||
|
||||
t.end()
|
||||
}
|
||||
mailer[type](message)
|
||||
}
|
||||
)
|
||||
} else if (type === 'verificationReminderEmail') {
|
||||
var reminderMessage = extend(message, {
|
||||
type: 'customType'
|
||||
|
@ -565,7 +524,7 @@ P.all(
|
|||
var message = {
|
||||
email: 'test@restmail.net',
|
||||
subject: 'subject',
|
||||
template: 'suspiciousLocationEmail',
|
||||
template: 'verifyLoginEmail',
|
||||
uid: 'foo'
|
||||
}
|
||||
|
||||
|
@ -588,7 +547,7 @@ P.all(
|
|||
var message = {
|
||||
email: 'test@restmail.net',
|
||||
subject: 'subject',
|
||||
template: 'suspiciousLocationEmail',
|
||||
template: 'verifyLoginEmail',
|
||||
uid: 'foo'
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче