refactor(fxa-auth-server): Added prefer-template rule in .eslintrc
This commit is contained in:
Родитель
2ee331e64a
Коммит
4761ad010d
|
@ -8,6 +8,7 @@ rules:
|
|||
no-var: 2
|
||||
prefer-arrow-callback: 2
|
||||
prefer-const: 2
|
||||
prefer-template: 2
|
||||
strict: 2
|
||||
semi: [2, "always"]
|
||||
indent: [0, 2]
|
||||
|
|
|
@ -114,7 +114,7 @@ function run(config) {
|
|||
server = await Server.create(log, error, config, routes, db, oauthdb, translator);
|
||||
try {
|
||||
await server.start();
|
||||
log.info({op: 'server.start.1', msg: 'running on ' + server.info.uri});
|
||||
log.info({op: 'server.start.1', msg: `running on ${ server.info.uri}`});
|
||||
} catch (err) {
|
||||
log.error(
|
||||
{
|
||||
|
|
|
@ -883,8 +883,8 @@ const conf = convict({
|
|||
// files to process, which will be overlayed in order, in the CONFIG_FILES
|
||||
// environment variable.
|
||||
|
||||
let envConfig = path.join(__dirname, conf.get('env') + '.json');
|
||||
envConfig = envConfig + ',' + (process.env.CONFIG_FILES || '');
|
||||
let envConfig = path.join(__dirname, `${conf.get('env') }.json`);
|
||||
envConfig = `${envConfig },${ process.env.CONFIG_FILES || ''}`;
|
||||
const files = envConfig.split(',').filter(fs.existsSync);
|
||||
conf.loadFile(files);
|
||||
conf.validate({ allowed: 'strict' });
|
||||
|
@ -893,18 +893,18 @@ conf.validate({ allowed: 'strict' });
|
|||
conf.set('domain', url.parse(conf.get('publicUrl')).host);
|
||||
|
||||
// derive fxa-auth-mailer configuration from our content-server url
|
||||
conf.set('smtp.accountSettingsUrl', conf.get('contentServer.url') + '/settings');
|
||||
conf.set('smtp.accountRecoveryCodesUrl', conf.get('contentServer.url') + '/settings/two_step_authentication/recovery_codes');
|
||||
conf.set('smtp.verificationUrl', conf.get('contentServer.url') + '/verify_email');
|
||||
conf.set('smtp.passwordResetUrl', conf.get('contentServer.url') + '/complete_reset_password');
|
||||
conf.set('smtp.initiatePasswordResetUrl', conf.get('contentServer.url') + '/reset_password');
|
||||
conf.set('smtp.initiatePasswordChangeUrl', conf.get('contentServer.url') + '/settings/change_password');
|
||||
conf.set('smtp.verifyLoginUrl', conf.get('contentServer.url') + '/complete_signin');
|
||||
conf.set('smtp.reportSignInUrl', conf.get('contentServer.url') + '/report_signin');
|
||||
conf.set('smtp.revokeAccountRecoveryUrl', conf.get('contentServer.url') + '/settings/account_recovery/confirm_revoke');
|
||||
conf.set('smtp.createAccountRecoveryUrl', conf.get('contentServer.url') + '/settings/account_recovery/confirm_password');
|
||||
conf.set('smtp.verifyPrimaryEmailUrl', conf.get('contentServer.url') + '/verify_primary_email');
|
||||
conf.set('smtp.verifySecondaryEmailUrl', conf.get('contentServer.url') + '/verify_secondary_email');
|
||||
conf.set('smtp.accountSettingsUrl', `${conf.get('contentServer.url') }/settings`);
|
||||
conf.set('smtp.accountRecoveryCodesUrl', `${conf.get('contentServer.url') }/settings/two_step_authentication/recovery_codes`);
|
||||
conf.set('smtp.verificationUrl', `${conf.get('contentServer.url') }/verify_email`);
|
||||
conf.set('smtp.passwordResetUrl', `${conf.get('contentServer.url') }/complete_reset_password`);
|
||||
conf.set('smtp.initiatePasswordResetUrl', `${conf.get('contentServer.url') }/reset_password`);
|
||||
conf.set('smtp.initiatePasswordChangeUrl', `${conf.get('contentServer.url') }/settings/change_password`);
|
||||
conf.set('smtp.verifyLoginUrl', `${conf.get('contentServer.url') }/complete_signin`);
|
||||
conf.set('smtp.reportSignInUrl', `${conf.get('contentServer.url') }/report_signin`);
|
||||
conf.set('smtp.revokeAccountRecoveryUrl', `${conf.get('contentServer.url') }/settings/account_recovery/confirm_revoke`);
|
||||
conf.set('smtp.createAccountRecoveryUrl', `${conf.get('contentServer.url') }/settings/account_recovery/confirm_password`);
|
||||
conf.set('smtp.verifyPrimaryEmailUrl', `${conf.get('contentServer.url') }/verify_primary_email`);
|
||||
conf.set('smtp.verifySecondaryEmailUrl', `${conf.get('contentServer.url') }/verify_secondary_email`);
|
||||
|
||||
conf.set('isProduction', conf.get('env') === 'prod');
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ module.exports = {
|
|||
verificationMethodToAMR(verificationMethod) {
|
||||
const amr = METHOD_TO_AMR[verificationMethod];
|
||||
if (! amr) {
|
||||
throw new Error('unknown verificationMethod: ' + verificationMethod);
|
||||
throw new Error(`unknown verificationMethod: ${ verificationMethod}`);
|
||||
}
|
||||
return amr;
|
||||
},
|
||||
|
|
|
@ -10,7 +10,7 @@ const P = require('../promise');
|
|||
const NAMESPACE = 'identity.mozilla.com/picl/v1/';
|
||||
|
||||
function KWE(name, email) {
|
||||
return Buffer.from(NAMESPACE + name + ':' + email);
|
||||
return Buffer.from(`${NAMESPACE + name }:${ email}`);
|
||||
}
|
||||
|
||||
function KW(name) {
|
||||
|
|
|
@ -161,7 +161,7 @@ function AppError(options, extra, headers) {
|
|||
inherits(AppError, Error);
|
||||
|
||||
AppError.prototype.toString = function () {
|
||||
return 'Error: ' + this.message;
|
||||
return `Error: ${ this.message}`;
|
||||
};
|
||||
|
||||
AppError.prototype.header = function (name, value) {
|
||||
|
@ -191,7 +191,7 @@ AppError.translate = function (request, response) {
|
|||
// These are common errors generated by Hawk auth lib.
|
||||
if (payload.message === 'Unknown credentials' ||
|
||||
payload.message === 'Invalid credentials') {
|
||||
error = AppError.invalidToken('Invalid authentication token: ' + payload.message);
|
||||
error = AppError.invalidToken(`Invalid authentication token: ${ payload.message}`);
|
||||
}
|
||||
else if (payload.message === 'Stale timestamp') {
|
||||
error = AppError.invalidTimestamp();
|
||||
|
@ -203,7 +203,7 @@ AppError.translate = function (request, response) {
|
|||
error = AppError.invalidSignature(payload.message);
|
||||
}
|
||||
else {
|
||||
error = AppError.invalidToken('Invalid authentication token: ' + payload.message);
|
||||
error = AppError.invalidToken(`Invalid authentication token: ${ payload.message}`);
|
||||
}
|
||||
}
|
||||
else if (payload.validation) {
|
||||
|
@ -354,7 +354,7 @@ AppError.missingRequestParameter = function (param) {
|
|||
code: 400,
|
||||
error: 'Bad Request',
|
||||
errno: ERRNO.MISSING_PARAMETER,
|
||||
message: 'Missing parameter in request body' + (param ? ': ' + param : '')
|
||||
message: `Missing parameter in request body${ param ? `: ${ param}` : ''}`
|
||||
},
|
||||
{
|
||||
param: param
|
||||
|
|
|
@ -363,7 +363,7 @@ module.exports = function (log, db, config) {
|
|||
devices = filterSupportedDevices(options.data, devices);
|
||||
const events = pushReasonsToEvents[reason];
|
||||
if (! events) {
|
||||
return P.reject('Unknown push reason: ' + reason);
|
||||
return P.reject(`Unknown push reason: ${ reason}`);
|
||||
}
|
||||
// There's no spec-compliant way to error out as a result of having
|
||||
// too many devices to notify. For now, just log metrics about it.
|
||||
|
|
|
@ -86,7 +86,7 @@ module.exports = function (
|
|||
util,
|
||||
recoveryKey
|
||||
);
|
||||
v1Routes.forEach(r => { r.path = basePath + '/v1' + r.path; });
|
||||
v1Routes.forEach(r => { r.path = `${basePath }/v1${ r.path}`; });
|
||||
defaults.forEach(r => { r.path = basePath + r.path; });
|
||||
const allRoutes = defaults.concat(idp, v1Routes);
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ module.exports = (log, signer, db, domain, devices) => {
|
|||
|
||||
return signer.sign(
|
||||
{
|
||||
email: uid + '@' + domain,
|
||||
email: `${uid }@${ domain}`,
|
||||
publicKey: publicKey,
|
||||
domain: domain,
|
||||
duration: duration,
|
||||
|
|
|
@ -126,7 +126,7 @@ module.exports.redirectTo = function redirectTo(base) {
|
|||
const validator = isA.string().max(512);
|
||||
let hostnameRegex = null;
|
||||
if (base) {
|
||||
hostnameRegex = new RegExp('(?:\\.|^)' + base.replace('.', '\\.') + '$');
|
||||
hostnameRegex = new RegExp(`(?:\\.|^)${ base.replace('.', '\\.') }$`);
|
||||
}
|
||||
validator._tests.push(
|
||||
{
|
||||
|
|
|
@ -113,7 +113,7 @@ module.exports = function (log, config, oauthdb) {
|
|||
function linkAttributes(url) {
|
||||
// Not very nice to have presentation code in here, but this is to help l10n
|
||||
// contributors not deal with extraneous noise in strings.
|
||||
return 'href="' + url + '" style="color: #0a84ff; text-decoration: none; font-family: sans-serif;"';
|
||||
return `href="${ url }" style="color: #0a84ff; text-decoration: none; font-family: sans-serif;"`;
|
||||
}
|
||||
|
||||
function constructLocalTimeString (timeZone, locale) {
|
||||
|
@ -214,7 +214,7 @@ module.exports = function (log, config, oauthdb) {
|
|||
return uaBrowser;
|
||||
} else if (uaOS) {
|
||||
if (uaOSVersion) {
|
||||
const parts = uaOS + ' ' + uaOSVersion;
|
||||
const parts = `${uaOS } ${ uaOSVersion}`;
|
||||
return parts;
|
||||
}
|
||||
else {
|
||||
|
@ -1378,7 +1378,7 @@ module.exports = function (log, config, oauthdb) {
|
|||
|
||||
const queryOneClick = extend(query, {one_click: true});
|
||||
if (primaryLink && utmContent) {
|
||||
links['oneClickLink'] = this._generateUTMLink(primaryLink, queryOneClick, templateName, utmContent + '-oneclick');
|
||||
links['oneClickLink'] = this._generateUTMLink(primaryLink, queryOneClick, templateName, `${utmContent }-oneclick`);
|
||||
}
|
||||
|
||||
return links;
|
||||
|
|
|
@ -24,18 +24,18 @@ function generateTemplateName (str) {
|
|||
return str;
|
||||
}
|
||||
|
||||
return str.replace(/_(.)/g,
|
||||
return `${str.replace(/_(.)/g,
|
||||
(match, c) => {
|
||||
return c.toUpperCase();
|
||||
}
|
||||
) + 'Email';
|
||||
) }Email`;
|
||||
}
|
||||
|
||||
function loadTemplates(name) {
|
||||
return P.all(
|
||||
[
|
||||
readFile(path.join(__dirname, name + '.txt'), { encoding: 'utf8' }),
|
||||
readFile(path.join(__dirname, name + '.html'), { encoding: 'utf8' })
|
||||
readFile(path.join(__dirname, `${name }.txt`), { encoding: 'utf8' }),
|
||||
readFile(path.join(__dirname, `${name }.html`), { encoding: 'utf8' })
|
||||
]
|
||||
)
|
||||
.spread(
|
||||
|
|
|
@ -26,7 +26,7 @@ function trimLocale(header) {
|
|||
let str = parts[0];
|
||||
if (str.length >= 255) { return null; }
|
||||
for (let i = 1; i < parts.length && str.length + parts[i].length < 255; i++) {
|
||||
str += ',' + parts[i];
|
||||
str += `,${ parts[i]}`;
|
||||
}
|
||||
return str.trim();
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ async function create (log, error, config, routes, db, oauthdb, translator) {
|
|||
response.backtrace(request.app.traced);
|
||||
}
|
||||
}
|
||||
response.header('Timestamp', '' + Math.floor(Date.now() / 1000));
|
||||
response.header('Timestamp', `${ Math.floor(Date.now() / 1000)}`);
|
||||
log.summary(request, response);
|
||||
return response;
|
||||
});
|
||||
|
|
|
@ -40,7 +40,7 @@ return bulkMailer(path.resolve(program.input), program.method, BATCH_SIZE, BATCH
|
|||
}, (err) => {
|
||||
if (/InvalidMethodName/.test(err.message)) {
|
||||
console.error(program.method, 'is not a valid method. Can be one of:\n');
|
||||
console.error(' * ' + err.validNames.sort().join('\n * '));
|
||||
console.error(` * ${ err.validNames.sort().join('\n * ')}`);
|
||||
} else {
|
||||
console.error('Error', String(err));
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ return bulkMailer(path.resolve(program.input), program.method, BATCH_SIZE, BATCH
|
|||
|
||||
function checkRequiredOption(optionName) {
|
||||
if (! program[optionName]) {
|
||||
console.error('--' + optionName + ' is required');
|
||||
console.error(`--${ optionName } is required`);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,15 +17,15 @@ module.exports = class StreamOutputMock extends NodemailerMock {
|
|||
this.stream.write('-----------------------------------\n');
|
||||
this.stream.write(`headers: ${emailConfig.to}\n`);
|
||||
this.stream.write('-----------------------------------\n');
|
||||
this.stream.write(JSON.stringify(emailConfig.headers, null, 2) + '\n');
|
||||
this.stream.write(`${JSON.stringify(emailConfig.headers, null, 2) }\n`);
|
||||
this.stream.write('-----------------------------------\n');
|
||||
this.stream.write(`html: ${emailConfig.to}\n`);
|
||||
this.stream.write('-----------------------------------\n');
|
||||
this.stream.write(emailConfig.html + '\n');
|
||||
this.stream.write(`${emailConfig.html }\n`);
|
||||
this.stream.write('-----------------------------------\n');
|
||||
this.stream.write(`text: ${emailConfig.to}\n`);
|
||||
this.stream.write('-----------------------------------\n');
|
||||
this.stream.write(emailConfig.text + '\n');
|
||||
this.stream.write(`${emailConfig.text }\n`);
|
||||
this.stream.write('===================================\n\n');
|
||||
|
||||
return super.sendMail(emailConfig, callback);
|
||||
|
|
|
@ -21,13 +21,13 @@ module.exports = class WriteToDiskMock extends NodemailerMock {
|
|||
targets.forEach(email => {
|
||||
const outputPath = path.join(this.outputDir, email);
|
||||
|
||||
const textPath = outputPath + '.txt';
|
||||
const textPath = `${outputPath }.txt`;
|
||||
fs.writeFileSync(textPath, emailConfig.text);
|
||||
|
||||
const htmlPath = outputPath + '.html';
|
||||
const htmlPath = `${outputPath }.html`;
|
||||
fs.writeFileSync(htmlPath, emailConfig.html);
|
||||
|
||||
const headersPath = outputPath + '.headers';
|
||||
const headersPath = `${outputPath }.headers`;
|
||||
fs.writeFileSync(headersPath, JSON.stringify(emailConfig.headers, null, 2));
|
||||
});
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ module.exports = function dumpUsers(keys, dbFunc, usePretty) {
|
|||
.then(_db => {
|
||||
db = _db;
|
||||
return P.mapSeries(keys, (item) => db[dbFunc](item).catch(err => {
|
||||
console.error(String(err) + ' - ' + item);
|
||||
console.error(`${String(err) } - ${ item}`);
|
||||
process.exit(1);
|
||||
}));
|
||||
})
|
||||
|
|
|
@ -58,7 +58,7 @@ function configure() {
|
|||
function log(level /*, rest */) {
|
||||
if (level < log.level) return;
|
||||
const args = Array.prototype.slice.call(arguments);
|
||||
const timestamp = '[' + new Date().toISOString() + ']';
|
||||
const timestamp = `[${ new Date().toISOString() }]`;
|
||||
args[0] = timestamp;
|
||||
console.log.apply(null, args);
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ log.DEBUG = 1;
|
|||
log.level = log.INFO;
|
||||
|
||||
function emailFromLang(lang) {
|
||||
return program.basename + '-' + lang + '@' + program.restmailDomain;
|
||||
return `${program.basename }-${ lang }@${ program.restmailDomain}`;
|
||||
}
|
||||
|
||||
function langFromEmail(email) {
|
||||
|
@ -215,11 +215,11 @@ function main() {
|
|||
const output = [];
|
||||
let errorCount = 0;
|
||||
Object.keys(errors).sort().forEach((lang) => {
|
||||
output.push(' ' + lang + ':');
|
||||
output.push(` ${ lang }:`);
|
||||
const errorList = errors[lang];
|
||||
errorList.forEach((err) => {
|
||||
errorCount++;
|
||||
output.push(' ' + err);
|
||||
output.push(` ${ err}`);
|
||||
});
|
||||
});
|
||||
if (errorCount > 0) {
|
||||
|
|
|
@ -24,7 +24,7 @@ function langFromEmail(email) {
|
|||
|
||||
function ensureHeader(headers, key, lang) {
|
||||
if (! headers[key]) {
|
||||
reportError(lang, 'Missing header ' + key);
|
||||
reportError(lang, `Missing header ${ key}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ function checkContent(mail, idx) {
|
|||
});
|
||||
|
||||
if (missing.length !== 0) {
|
||||
reportError(lang, 'missing x-headers ' + JSON.stringify(missing));
|
||||
reportError(lang, `missing x-headers ${ JSON.stringify(missing)}`);
|
||||
}
|
||||
|
||||
const xlink = url.parse(mail.headers['x-link'], true);
|
||||
|
@ -113,13 +113,13 @@ function checkContent(mail, idx) {
|
|||
const args = JSON.stringify(contentChecks.args.sort());
|
||||
const queryArgs = JSON.stringify(Object.keys(xlink.query).sort());
|
||||
if (args !== queryArgs) {
|
||||
reportError(lang, mail.headers['x-link'] + ' - args mismatch ' + args + ' - ' + queryArgs);
|
||||
reportError(lang, `${mail.headers['x-link'] } - args mismatch ${ args } - ${ queryArgs}`);
|
||||
}
|
||||
}
|
||||
|
||||
function ensureNonZeroContent(body, errmsg, lang) {
|
||||
if (body.length === 0) {
|
||||
reportError(lang, errmsg + ' has zero length');
|
||||
reportError(lang, `${errmsg } has zero length`);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ function verifyMailbox(mbox) {
|
|||
const lang = langFromEmail(mbox[0].headers.to);
|
||||
const expectedMessageCount = 6;
|
||||
if (mbox.length !== expectedMessageCount) {
|
||||
return reportError(lang, 'Missing email response, count: ' + mbox.length);
|
||||
return reportError(lang, `Missing email response, count: ${ mbox.length}`);
|
||||
}
|
||||
|
||||
mbox.forEach((mail, idx) => {
|
||||
|
|
|
@ -52,8 +52,8 @@ try {
|
|||
function addKeyProperties(key) {
|
||||
const now = new Date();
|
||||
key.kty = 'RSA';
|
||||
key.kid = now.toISOString().slice(0, 10) + '-' +
|
||||
crypto.createHash('sha256').update(key.n).update(key.e).digest('hex').slice(0, 32);
|
||||
key.kid = `${now.toISOString().slice(0, 10) }-${
|
||||
crypto.createHash('sha256').update(key.n).update(key.e).digest('hex').slice(0, 32)}`;
|
||||
// Timestamp to nearest hour; consumers don't need to know the precise time.
|
||||
key['fxa-createdAt'] = Math.round(now / 1000 / 3600) * 3600;
|
||||
return key;
|
||||
|
|
|
@ -83,7 +83,7 @@ DB.connect(config[config.db.backend])
|
|||
|
||||
function checkRequiredOption(optionName) {
|
||||
if (! commandLineOptions[optionName]) {
|
||||
console.error('--' + optionName + ' required');
|
||||
console.error(`--${ optionName } required`);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ require('../lib/senders/translator')(config.i18n.supportedLanguages, config.i18n
|
|||
});
|
||||
|
||||
function getEmailOutputPath(subject, extension) {
|
||||
const outputFilename = subject.replace(/\s+/g, '_') + '.' + extension;
|
||||
const outputFilename = `${subject.replace(/\s+/g, '_') }.${ extension}`;
|
||||
return path.join(OUTPUT_DIRECTORY, outputFilename);
|
||||
}
|
||||
|
||||
|
@ -128,8 +128,8 @@ function checkMessageType(mailer, messageToSend) {
|
|||
messageTypes.push('all');
|
||||
|
||||
if (messageTypes.indexOf(messageToSend) === -1) {
|
||||
console.error('invalid message name: `' + messageToSend + '`\n' +
|
||||
'choose from: ' + messageTypes.join(', '));
|
||||
console.error(`invalid message name: \`${ messageToSend }\`\n` +
|
||||
`choose from: ${ messageTypes.join(', ')}`);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ const Client = require('../client')();
|
|||
|
||||
const config = {
|
||||
origin: 'http://127.0.0.1:9000',
|
||||
email: Math.random() + 'benchmark@example.com',
|
||||
email: `${Math.random() }benchmark@example.com`,
|
||||
password: 'password',
|
||||
duration: 120000
|
||||
};
|
||||
|
|
|
@ -18,7 +18,7 @@ module.exports = config => {
|
|||
function ClientApi(origin) {
|
||||
EventEmitter.call(this);
|
||||
this.origin = origin;
|
||||
this.baseURL = origin + '/v1';
|
||||
this.baseURL = `${origin }/v1`;
|
||||
this.timeOffset = 0;
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ module.exports = config => {
|
|||
// because tokenLifetimes.passwordChangeToken is -1
|
||||
const config = require('../../config');
|
||||
if (config.get('corsOrigin').indexOf(allowedOrigin) < 0) {
|
||||
return d.reject(new Error('Unexpected allowed origin: ' + allowedOrigin));
|
||||
return d.reject(new Error(`Unexpected allowed origin: ${ allowedOrigin}`));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ module.exports = config => {
|
|||
// because tokenLifetimes.passwordChangeToken is -1
|
||||
const config = require('../../config');
|
||||
if (config.get('corsOrigin').indexOf(allowedOrigin) < 0) {
|
||||
return d.reject(new Error('Unexpected allowed origin: ' + allowedOrigin));
|
||||
return d.reject(new Error(`Unexpected allowed origin: ${ allowedOrigin}`));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,7 @@ module.exports = config => {
|
|||
*/
|
||||
ClientApi.prototype.accountCreate = function (email, authPW, options = {}) {
|
||||
|
||||
const url = this.baseURL + '/account/create' + getQueryString(options);
|
||||
const url = `${this.baseURL }/account/create${ getQueryString(options)}`;
|
||||
return this.doRequest(
|
||||
'POST',
|
||||
url,
|
||||
|
@ -175,7 +175,7 @@ module.exports = config => {
|
|||
|
||||
return this.doRequest(
|
||||
'POST',
|
||||
this.baseURL + '/account/login' + getQueryString(options),
|
||||
`${this.baseURL }/account/login${ getQueryString(options)}`,
|
||||
null,
|
||||
{
|
||||
email: email,
|
||||
|
@ -200,7 +200,7 @@ module.exports = config => {
|
|||
(token) => {
|
||||
return this.doRequest(
|
||||
'GET',
|
||||
this.baseURL + '/account/keys',
|
||||
`${this.baseURL }/account/keys`,
|
||||
token
|
||||
);
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ module.exports = config => {
|
|||
(token) => {
|
||||
return this.doRequest(
|
||||
'GET',
|
||||
this.baseURL + '/account/devices',
|
||||
`${this.baseURL }/account/devices`,
|
||||
token
|
||||
);
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ module.exports = config => {
|
|||
ClientApi.prototype.accountDevicesWithRefreshToken = function (refreshTokenHex) {
|
||||
return this.doRequestWithBearerToken(
|
||||
'GET',
|
||||
this.baseURL + '/account/devices',
|
||||
`${this.baseURL }/account/devices`,
|
||||
refreshTokenHex
|
||||
);
|
||||
};
|
||||
|
@ -234,7 +234,7 @@ module.exports = config => {
|
|||
(token) => {
|
||||
return this.doRequest(
|
||||
'POST',
|
||||
this.baseURL + '/account/device',
|
||||
`${this.baseURL }/account/device`,
|
||||
token,
|
||||
info
|
||||
);
|
||||
|
@ -245,7 +245,7 @@ module.exports = config => {
|
|||
ClientApi.prototype.accountDeviceWithRefreshToken = function (refreshTokenHex, info) {
|
||||
return this.doRequestWithBearerToken(
|
||||
'POST',
|
||||
this.baseURL + '/account/device',
|
||||
`${this.baseURL }/account/device`,
|
||||
refreshTokenHex,
|
||||
info
|
||||
);
|
||||
|
@ -257,7 +257,7 @@ module.exports = config => {
|
|||
(token) => {
|
||||
return this.doRequest(
|
||||
'POST',
|
||||
this.baseURL + '/account/device/destroy',
|
||||
`${this.baseURL }/account/device/destroy`,
|
||||
token,
|
||||
{
|
||||
id: id
|
||||
|
@ -270,7 +270,7 @@ module.exports = config => {
|
|||
ClientApi.prototype.deviceDestroyWithRefreshToken = function (refreshTokenHex, id) {
|
||||
return this.doRequestWithBearerToken(
|
||||
'POST',
|
||||
this.baseURL + '/account/device/destroy',
|
||||
`${this.baseURL }/account/device/destroy`,
|
||||
refreshTokenHex,
|
||||
{
|
||||
id: id
|
||||
|
@ -282,7 +282,7 @@ module.exports = config => {
|
|||
if (email) {
|
||||
return this.doRequest(
|
||||
'POST',
|
||||
this.baseURL + '/account/status',
|
||||
`${this.baseURL }/account/status`,
|
||||
null,
|
||||
{
|
||||
email: email
|
||||
|
@ -290,7 +290,7 @@ module.exports = config => {
|
|||
);
|
||||
}
|
||||
else {
|
||||
return this.doRequest('POST', this.baseURL + '/account/status');
|
||||
return this.doRequest('POST', `${this.baseURL }/account/status`);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -301,7 +301,7 @@ module.exports = config => {
|
|||
(token) => {
|
||||
return this.doRequest(
|
||||
'GET',
|
||||
this.baseURL + '/account/status',
|
||||
`${this.baseURL }/account/status`,
|
||||
token
|
||||
);
|
||||
}
|
||||
|
@ -310,12 +310,12 @@ module.exports = config => {
|
|||
else if (uid) {
|
||||
return this.doRequest(
|
||||
'GET',
|
||||
this.baseURL + '/account/status?uid=' + uid
|
||||
`${this.baseURL }/account/status?uid=${ uid}`
|
||||
);
|
||||
}
|
||||
else {
|
||||
// for testing the error response only
|
||||
return this.doRequest('GET', this.baseURL + '/account/status');
|
||||
return this.doRequest('GET', `${this.baseURL }/account/status`);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -332,7 +332,7 @@ module.exports = config => {
|
|||
(token) => {
|
||||
return this.doRequest(
|
||||
'POST',
|
||||
this.baseURL + '/account/reset' + qs,
|
||||
`${this.baseURL }/account/reset${ qs}`,
|
||||
token,
|
||||
{
|
||||
authPW: authPW.toString('hex'),
|
||||
|
@ -352,7 +352,7 @@ module.exports = config => {
|
|||
(token) => {
|
||||
return this.doRequest(
|
||||
'POST',
|
||||
this.baseURL + '/account/reset' + qs,
|
||||
`${this.baseURL }/account/reset${ qs}`,
|
||||
token,
|
||||
{
|
||||
authPW: authPW.toString('hex'),
|
||||
|
@ -369,7 +369,7 @@ module.exports = config => {
|
|||
ClientApi.prototype.accountDestroy = function (email, authPW) {
|
||||
return this.doRequest(
|
||||
'POST',
|
||||
this.baseURL + '/account/destroy',
|
||||
`${this.baseURL }/account/destroy`,
|
||||
null,
|
||||
{
|
||||
email: email,
|
||||
|
@ -383,7 +383,7 @@ module.exports = config => {
|
|||
.then((token) => {
|
||||
return this.doRequest(
|
||||
'POST',
|
||||
this.baseURL + '/account/destroy',
|
||||
`${this.baseURL }/account/destroy`,
|
||||
token,
|
||||
{
|
||||
email,
|
||||
|
@ -398,7 +398,7 @@ module.exports = config => {
|
|||
(token) => {
|
||||
return this.doRequest(
|
||||
'GET',
|
||||
this.baseURL + '/recovery_email/status',
|
||||
`${this.baseURL }/recovery_email/status`,
|
||||
token
|
||||
);
|
||||
}
|
||||
|
@ -412,7 +412,7 @@ module.exports = config => {
|
|||
(token) => {
|
||||
return this.doRequest(
|
||||
'POST',
|
||||
this.baseURL + '/recovery_email/resend_code',
|
||||
`${this.baseURL }/recovery_email/resend_code`,
|
||||
token,
|
||||
{
|
||||
service: options.service || undefined,
|
||||
|
@ -429,7 +429,7 @@ module.exports = config => {
|
|||
ClientApi.prototype.recoveryEmailVerifyCode = function (uid, code, options = {}) {
|
||||
return this.doRequest(
|
||||
'POST',
|
||||
this.baseURL + '/recovery_email/verify_code',
|
||||
`${this.baseURL }/recovery_email/verify_code`,
|
||||
null,
|
||||
{
|
||||
uid: uid,
|
||||
|
@ -448,9 +448,9 @@ module.exports = config => {
|
|||
return tokens.SessionToken.fromHex(sessionTokenHex)
|
||||
.then(
|
||||
(token) => {
|
||||
let url = this.baseURL + '/certificate/sign';
|
||||
let url = `${this.baseURL }/certificate/sign`;
|
||||
if (options.service) {
|
||||
url += '?service=' + options.service;
|
||||
url += `?service=${ options.service}`;
|
||||
}
|
||||
return this.doRequest(
|
||||
'POST',
|
||||
|
@ -471,14 +471,14 @@ module.exports = config => {
|
|||
ClientApi.prototype.getRandomBytes = function () {
|
||||
return this.doRequest(
|
||||
'POST',
|
||||
this.baseURL + '/get_random_bytes'
|
||||
`${this.baseURL }/get_random_bytes`
|
||||
);
|
||||
};
|
||||
|
||||
ClientApi.prototype.passwordChangeStart = function (email, oldAuthPW, headers) {
|
||||
return this.doRequest(
|
||||
'POST',
|
||||
this.baseURL + '/password/change/start',
|
||||
`${this.baseURL }/password/change/start`,
|
||||
null,
|
||||
{
|
||||
email: email,
|
||||
|
@ -506,7 +506,7 @@ module.exports = config => {
|
|||
|
||||
return this.doRequest(
|
||||
'POST',
|
||||
this.baseURL + '/password/change/finish' + getQueryString(options),
|
||||
`${this.baseURL }/password/change/finish${ getQueryString(options)}`,
|
||||
token,
|
||||
requestData,
|
||||
headers
|
||||
|
@ -525,7 +525,7 @@ module.exports = config => {
|
|||
}
|
||||
return this.doRequest(
|
||||
'POST',
|
||||
this.baseURL + '/password/forgot/send_code' + getQueryString(options),
|
||||
`${this.baseURL }/password/forgot/send_code${ getQueryString(options)}`,
|
||||
null,
|
||||
{
|
||||
email: email,
|
||||
|
@ -544,7 +544,7 @@ module.exports = config => {
|
|||
(token) => {
|
||||
return this.doRequest(
|
||||
'POST',
|
||||
this.baseURL + '/password/forgot/resend_code' + getQueryString(options),
|
||||
`${this.baseURL }/password/forgot/resend_code${ getQueryString(options)}`,
|
||||
token,
|
||||
{
|
||||
email: email,
|
||||
|
@ -567,7 +567,7 @@ module.exports = config => {
|
|||
(token) => {
|
||||
return this.doRequest(
|
||||
'POST',
|
||||
this.baseURL + '/password/forgot/verify_code',
|
||||
`${this.baseURL }/password/forgot/verify_code`,
|
||||
token,
|
||||
{
|
||||
code: code,
|
||||
|
@ -585,7 +585,7 @@ module.exports = config => {
|
|||
(token) => {
|
||||
return this.doRequest(
|
||||
'GET',
|
||||
this.baseURL + '/password/forgot/status',
|
||||
`${this.baseURL }/password/forgot/status`,
|
||||
token
|
||||
);
|
||||
}
|
||||
|
@ -595,7 +595,7 @@ module.exports = config => {
|
|||
ClientApi.prototype.accountLock = function (email, authPW) {
|
||||
return this.doRequest(
|
||||
'POST',
|
||||
this.baseURL + '/account/lock',
|
||||
`${this.baseURL }/account/lock`,
|
||||
null,
|
||||
{
|
||||
email: email,
|
||||
|
@ -613,7 +613,7 @@ module.exports = config => {
|
|||
}
|
||||
return this.doRequest(
|
||||
'POST',
|
||||
this.baseURL + '/account/unlock/resend_code',
|
||||
`${this.baseURL }/account/unlock/resend_code`,
|
||||
null,
|
||||
{
|
||||
email: email,
|
||||
|
@ -628,7 +628,7 @@ module.exports = config => {
|
|||
ClientApi.prototype.accountUnlockVerifyCode = function (uid, code) {
|
||||
return this.doRequest(
|
||||
'POST',
|
||||
this.baseURL + '/account/unlock/verify_code',
|
||||
`${this.baseURL }/account/unlock/verify_code`,
|
||||
null,
|
||||
{
|
||||
uid: uid,
|
||||
|
@ -651,7 +651,7 @@ module.exports = config => {
|
|||
(token) => {
|
||||
return this.doRequest(
|
||||
'POST',
|
||||
this.baseURL + '/session/destroy',
|
||||
`${this.baseURL }/session/destroy`,
|
||||
token,
|
||||
data
|
||||
);
|
||||
|
@ -665,7 +665,7 @@ module.exports = config => {
|
|||
(token) => {
|
||||
return this.doRequest(
|
||||
'POST',
|
||||
this.baseURL + '/session/reauth' + getQueryString(options),
|
||||
`${this.baseURL }/session/reauth${ getQueryString(options)}`,
|
||||
token,
|
||||
{
|
||||
email: email,
|
||||
|
@ -686,7 +686,7 @@ module.exports = config => {
|
|||
(token) => {
|
||||
return this.doRequest(
|
||||
'POST',
|
||||
this.baseURL + '/session/duplicate',
|
||||
`${this.baseURL }/session/duplicate`,
|
||||
token,
|
||||
{}
|
||||
);
|
||||
|
@ -700,7 +700,7 @@ module.exports = config => {
|
|||
(token) => {
|
||||
return this.doRequest(
|
||||
'GET',
|
||||
this.baseURL + '/account/sessions',
|
||||
`${this.baseURL }/account/sessions`,
|
||||
token
|
||||
);
|
||||
}
|
||||
|
@ -713,7 +713,7 @@ module.exports = config => {
|
|||
(token) => {
|
||||
return this.doRequest(
|
||||
'GET',
|
||||
this.baseURL + '/session/status',
|
||||
`${this.baseURL }/session/status`,
|
||||
token
|
||||
);
|
||||
}
|
||||
|
@ -726,7 +726,7 @@ module.exports = config => {
|
|||
(token) => {
|
||||
return this.doRequest(
|
||||
'GET',
|
||||
this.baseURL + '/account/profile',
|
||||
`${this.baseURL }/account/profile`,
|
||||
token,
|
||||
undefined,
|
||||
headers
|
||||
|
@ -762,7 +762,7 @@ module.exports = config => {
|
|||
(token) => {
|
||||
return this.doRequest(
|
||||
'GET',
|
||||
this.baseURL + '/recovery_emails',
|
||||
`${this.baseURL }/recovery_emails`,
|
||||
token
|
||||
);
|
||||
}
|
||||
|
@ -775,7 +775,7 @@ module.exports = config => {
|
|||
(token) => {
|
||||
return this.doRequest(
|
||||
'POST',
|
||||
this.baseURL + '/recovery_email',
|
||||
`${this.baseURL }/recovery_email`,
|
||||
token,
|
||||
{
|
||||
email: email
|
||||
|
@ -791,7 +791,7 @@ module.exports = config => {
|
|||
(token) => {
|
||||
return this.doRequest(
|
||||
'POST',
|
||||
this.baseURL + '/recovery_email/destroy',
|
||||
`${this.baseURL }/recovery_email/destroy`,
|
||||
token,
|
||||
{
|
||||
email: email
|
||||
|
@ -807,7 +807,7 @@ module.exports = config => {
|
|||
(token) => {
|
||||
return this.doRequest(
|
||||
'POST',
|
||||
this.baseURL + '/recovery_email/set_primary',
|
||||
`${this.baseURL }/recovery_email/set_primary`,
|
||||
token,
|
||||
{
|
||||
email: email
|
||||
|
@ -820,7 +820,7 @@ module.exports = config => {
|
|||
ClientApi.prototype.sendUnblockCode = function (email) {
|
||||
return this.doRequest(
|
||||
'POST',
|
||||
this.baseURL + '/account/login/send_unblock_code',
|
||||
`${this.baseURL }/account/login/send_unblock_code`,
|
||||
null,
|
||||
{
|
||||
email: email
|
||||
|
@ -842,7 +842,7 @@ module.exports = config => {
|
|||
.then((token) => {
|
||||
return this.doRequest(
|
||||
'POST',
|
||||
this.baseURL + '/session/verify/token',
|
||||
`${this.baseURL }/session/verify/token`,
|
||||
token,
|
||||
{
|
||||
code: code,
|
||||
|
@ -858,7 +858,7 @@ module.exports = config => {
|
|||
.then((token) => {
|
||||
return this.doRequest(
|
||||
'POST',
|
||||
this.baseURL + '/totp/create',
|
||||
`${this.baseURL }/totp/create`,
|
||||
token,
|
||||
{
|
||||
metricsContext: options.metricsContext
|
||||
|
@ -872,7 +872,7 @@ module.exports = config => {
|
|||
.then((token) => {
|
||||
return this.doRequest(
|
||||
'POST',
|
||||
this.baseURL + '/totp/destroy',
|
||||
`${this.baseURL }/totp/destroy`,
|
||||
token,
|
||||
{}
|
||||
);
|
||||
|
@ -884,7 +884,7 @@ module.exports = config => {
|
|||
.then((token) => {
|
||||
return this.doRequest(
|
||||
'GET',
|
||||
this.baseURL + '/totp/exists',
|
||||
`${this.baseURL }/totp/exists`,
|
||||
token
|
||||
).bind(this);
|
||||
});
|
||||
|
@ -895,7 +895,7 @@ module.exports = config => {
|
|||
.then((token) => {
|
||||
return this.doRequest(
|
||||
'POST',
|
||||
this.baseURL + '/session/verify/totp',
|
||||
`${this.baseURL }/session/verify/totp`,
|
||||
token,
|
||||
{
|
||||
code: code,
|
||||
|
@ -910,7 +910,7 @@ module.exports = config => {
|
|||
.then((token) => {
|
||||
return this.doRequest(
|
||||
'GET',
|
||||
this.baseURL + '/recoveryCodes',
|
||||
`${this.baseURL }/recoveryCodes`,
|
||||
token
|
||||
);
|
||||
});
|
||||
|
@ -921,7 +921,7 @@ module.exports = config => {
|
|||
.then((token) => {
|
||||
return this.doRequest(
|
||||
'POST',
|
||||
this.baseURL + '/session/verify/recoveryCode',
|
||||
`${this.baseURL }/session/verify/recoveryCode`,
|
||||
token,
|
||||
{
|
||||
code: code
|
||||
|
@ -935,7 +935,7 @@ module.exports = config => {
|
|||
.then((token) => {
|
||||
return this.doRequest(
|
||||
'POST',
|
||||
this.baseURL + '/recoveryKey',
|
||||
`${this.baseURL }/recoveryKey`,
|
||||
token,
|
||||
{
|
||||
recoveryKeyId,
|
||||
|
@ -989,7 +989,7 @@ module.exports = config => {
|
|||
};
|
||||
|
||||
ClientApi.heartbeat = function (origin) {
|
||||
return (new ClientApi(origin)).doRequest('GET', origin + '/__heartbeat__');
|
||||
return (new ClientApi(origin)).doRequest('GET', `${origin }/__heartbeat__`);
|
||||
};
|
||||
|
||||
function getQueryString (options) {
|
||||
|
@ -1000,15 +1000,15 @@ module.exports = config => {
|
|||
}
|
||||
|
||||
if (options.serviceQuery) {
|
||||
qs.push('service=' + options.serviceQuery);
|
||||
qs.push(`service=${ options.serviceQuery}`);
|
||||
}
|
||||
|
||||
if (options.createdAt) {
|
||||
qs.push('_createdAt=' + options.createdAt);
|
||||
qs.push(`_createdAt=${ options.createdAt}`);
|
||||
}
|
||||
|
||||
if (qs) {
|
||||
return '?' + qs.join('&');
|
||||
return `?${ qs.join('&')}`;
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
|
|
|
@ -467,7 +467,7 @@ module.exports = config => {
|
|||
|
||||
Client.prototype.accountProfile = function (oauthToken) {
|
||||
if (oauthToken) {
|
||||
return this.api.accountProfile(null, { Authorization: 'Bearer ' + oauthToken });
|
||||
return this.api.accountProfile(null, { Authorization: `Bearer ${ oauthToken}` });
|
||||
} else {
|
||||
const o = this.sessionToken ? P.resolve(null) : this.login();
|
||||
return o.then(
|
||||
|
|
|
@ -13,7 +13,7 @@ const error = require(`${ROOT_DIR}/lib/error`);
|
|||
const P = require('bluebird');
|
||||
const sinon = require('sinon');
|
||||
|
||||
const EMAIL = Math.random() + '@example.test';
|
||||
const EMAIL = `${Math.random() }@example.test`;
|
||||
const BOUNCE_TYPE_HARD = 1;
|
||||
const BOUNCE_TYPE_COMPLAINT = 3;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ describe('pbkdf2', () => {
|
|||
() => {
|
||||
const email = Buffer.from('ijqmkkafer3xsj5rzoq+msnxsacvkmqxabtsvxvj@some-test-domain-with-a-long-name-example.org');
|
||||
const password = Buffer.from('mSnxsacVkMQxAbtSVxVjCCoWArNUsFhiJqmkkafER3XSJ5rzoQ');
|
||||
const salt = Buffer.from('identity.mozilla.com/picl/v1/first-PBKDF:' + email);
|
||||
const salt = Buffer.from(`identity.mozilla.com/picl/v1/first-PBKDF:${ email}`);
|
||||
return pbkdf2.derive(password, salt, ITERATIONS, LENGTH)
|
||||
.then(
|
||||
(K1) => {
|
||||
|
|
|
@ -471,15 +471,15 @@ describe('Customs', () => {
|
|||
});
|
||||
|
||||
function newEmail() {
|
||||
return Math.random().toString().substr(2) + '@example.com';
|
||||
return `${Math.random().toString().substr(2) }@example.com`;
|
||||
}
|
||||
|
||||
function newIp() {
|
||||
return [
|
||||
'' + Math.floor(Math.random() * 256),
|
||||
'' + Math.floor(Math.random() * 256),
|
||||
'' + Math.floor(Math.random() * 256),
|
||||
'' + Math.floor(Math.random() * 256),
|
||||
`${ Math.floor(Math.random() * 256)}`,
|
||||
`${ Math.floor(Math.random() * 256)}`,
|
||||
`${ Math.floor(Math.random() * 256)}`,
|
||||
`${ Math.floor(Math.random() * 256)}`,
|
||||
].join('.');
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ describe('AppErrors', () => {
|
|||
const result = AppError.translate(null, {
|
||||
output: {
|
||||
payload: {
|
||||
message: 'foo' + messages.errors.any.required,
|
||||
message: `foo${ messages.errors.any.required}`,
|
||||
validation: {
|
||||
keys: [ 'bar', 'baz' ]
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ describe('oauthdb', () => {
|
|||
const MOCK_CREDENTIALS = {
|
||||
uid: MOCK_UID,
|
||||
verifierSetAt: 12345,
|
||||
email: MOCK_UID + '@example.com',
|
||||
email: `${MOCK_UID }@example.com`,
|
||||
lastAuthAt: () => 23456,
|
||||
emailVerified: true,
|
||||
tokenVerified: true,
|
||||
|
|
|
@ -534,7 +534,7 @@ describe('push', () => {
|
|||
const push = proxyquire(pushModulePath, mocks)(thisMockLog, mockDb, mockConfig);
|
||||
// Careful, the argument gets modified in-place.
|
||||
const device = JSON.parse(JSON.stringify(mockDevices[0]));
|
||||
device.pushPublicKey = 'E' + device.pushPublicKey.substring(1); // make the key invalid
|
||||
device.pushPublicKey = `E${ device.pushPublicKey.substring(1)}`; // make the key invalid
|
||||
return push.sendPush(mockUid, [device], 'accountVerify')
|
||||
.then(() => {
|
||||
assert.equal(count, 1);
|
||||
|
|
|
@ -267,7 +267,7 @@ describe('checkCustomsAndLoadAccount', () => {
|
|||
});
|
||||
|
||||
it('email addresses matching a configured regex get forcibly blocked', () => {
|
||||
const email = 'blockme-' + TEST_EMAIL;
|
||||
const email = `blockme-${ TEST_EMAIL}`;
|
||||
return checkCustomsAndLoadAccount(request, email).then(
|
||||
() => { assert.fail('should not succeed'); },
|
||||
(err) => {
|
||||
|
|
|
@ -251,7 +251,7 @@ describe(
|
|||
};
|
||||
|
||||
it(
|
||||
'Contains template header for ' + type,
|
||||
`Contains template header for ${ type}`,
|
||||
() => {
|
||||
mailer.mailer.sendMail = stubSendMail(emailConfig => {
|
||||
assert.equal(emailConfig.from, config.get('smtp.sender'), 'from header is correct');
|
||||
|
@ -286,7 +286,7 @@ describe(
|
|||
});
|
||||
|
||||
it(
|
||||
'test privacy link is in email template output for ' + type,
|
||||
`test privacy link is in email template output for ${ type}`,
|
||||
() => {
|
||||
const privacyLink = mailer.createPrivacyLink(type);
|
||||
|
||||
|
@ -300,7 +300,7 @@ describe(
|
|||
|
||||
if (type === 'verifySecondaryEmail') {
|
||||
it(
|
||||
'contains correct type ' + type,
|
||||
`contains correct type ${ type}`,
|
||||
() => {
|
||||
mailer.mailer.sendMail = stubSendMail(emailConfig => {
|
||||
assert.ok(includes(emailConfig.headers['X-Link'], 'type=secondary'));
|
||||
|
@ -316,7 +316,7 @@ describe(
|
|||
}
|
||||
|
||||
it(
|
||||
'If sesConfigurationSet is not defined, then outgoing email does not contain X-SES* headers, for type ' + type,
|
||||
`If sesConfigurationSet is not defined, then outgoing email does not contain X-SES* headers, for type ${ type}`,
|
||||
() => {
|
||||
assert.ok('sesConfigurationSet' in mailer, 'configuration key exists');
|
||||
mailer.mailer.sendMail = stubSendMail(emailConfig => {
|
||||
|
@ -331,7 +331,7 @@ describe(
|
|||
);
|
||||
|
||||
it(
|
||||
'If sesConfigurationSet is defined, then outgoing email will contain X-SES* headers, for type ' + type,
|
||||
`If sesConfigurationSet is defined, then outgoing email will contain X-SES* headers, for type ${ type}`,
|
||||
() => {
|
||||
assert.ok('sesConfigurationSet' in mailer, 'configuration key exists');
|
||||
const savedSesConfigurationSet = mailer.sesConfigurationSet;
|
||||
|
@ -354,7 +354,7 @@ describe(
|
|||
|
||||
if (includes(typesContainSupportLinks, type)) {
|
||||
it(
|
||||
'test support link is in email template output for ' + type,
|
||||
`test support link is in email template output for ${ type}`,
|
||||
() => {
|
||||
const supportTextLink = mailer.createSupportLink(type);
|
||||
|
||||
|
@ -369,7 +369,7 @@ describe(
|
|||
|
||||
if (includes(typesContainPasswordResetLinks, type)) {
|
||||
it(
|
||||
'reset password link is in email template output for ' + type,
|
||||
`reset password link is in email template output for ${ type}`,
|
||||
() => {
|
||||
const resetPasswordLink = mailer.createPasswordResetLink(message.email, type);
|
||||
|
||||
|
@ -386,7 +386,7 @@ describe(
|
|||
|
||||
if (includes(typesContainPasswordChangeLinks, type)) {
|
||||
it(
|
||||
'password change link is in email template output for ' + type,
|
||||
`password change link is in email template output for ${ type}`,
|
||||
() => {
|
||||
const passwordChangeLink = mailer.createPasswordChangeLink(message.email, type);
|
||||
|
||||
|
@ -403,7 +403,7 @@ describe(
|
|||
|
||||
if (includes(typesContainUnblockCode, type)) {
|
||||
it(
|
||||
'unblock code is in email template output for ' + type,
|
||||
`unblock code is in email template output for ${ type}`,
|
||||
() => {
|
||||
mailer.mailer.sendMail = stubSendMail(emailConfig => {
|
||||
assert.ok(includes(emailConfig.html, message.unblockCode));
|
||||
|
@ -428,7 +428,7 @@ describe(
|
|||
|
||||
if (includes(typesContainTokenCode, type)) {
|
||||
it(
|
||||
'login code is in email template output for ' + type,
|
||||
`login code is in email template output for ${ type}`,
|
||||
() => {
|
||||
mailer.mailer.sendMail = stubSendMail(emailConfig => {
|
||||
assert.ok(includes(emailConfig.html, message.tokenCode));
|
||||
|
@ -441,7 +441,7 @@ describe(
|
|||
|
||||
if (includes(typesContainReportSignInLinks, type)) {
|
||||
it(
|
||||
'report sign-in link is in email template output for ' + type,
|
||||
`report sign-in link is in email template output for ${ type}`,
|
||||
() => {
|
||||
mailer.mailer.sendMail = stubSendMail(emailConfig => {
|
||||
const reportSignInLink =
|
||||
|
@ -457,7 +457,7 @@ describe(
|
|||
}
|
||||
|
||||
if (includes(typesContainRevokeAccountRecoveryLinks, type)) {
|
||||
it('revoke account recovery link is in email template output for ' + type, () => {
|
||||
it(`revoke account recovery link is in email template output for ${ type}`, () => {
|
||||
mailer.mailer.sendMail = stubSendMail(emailConfig => {
|
||||
const link = mailer.createRevokeAccountRecoveryLink(type, message);
|
||||
assert.ok(includes(emailConfig.html, link));
|
||||
|
@ -470,7 +470,7 @@ describe(
|
|||
}
|
||||
|
||||
if (includes(typesContainCreateAccountRecoveryLinks, type)) {
|
||||
it('create account recovery link is in email template output for ' + type, () => {
|
||||
it(`create account recovery link is in email template output for ${ type}`, () => {
|
||||
mailer.mailer.sendMail = stubSendMail(emailConfig => {
|
||||
const link = mailer._generateCreateAccountRecoveryLinks(message, type).link;
|
||||
assert.ok(includes(emailConfig.html, link));
|
||||
|
@ -484,7 +484,7 @@ describe(
|
|||
|
||||
if (includes(typesContainAndroidStoreLinks, type)) {
|
||||
it(
|
||||
'Android store link is in email template output for ' + type,
|
||||
`Android store link is in email template output for ${ type}`,
|
||||
() => {
|
||||
const androidStoreLink = mailer.androidUrl;
|
||||
|
||||
|
@ -500,7 +500,7 @@ describe(
|
|||
|
||||
if (includes(typesContainIOSStoreLinks, type)) {
|
||||
it(
|
||||
'IOS store link is in email template output for ' + type,
|
||||
`IOS store link is in email template output for ${ type}`,
|
||||
() => {
|
||||
const iosStoreLink = mailer.iosUrl;
|
||||
|
||||
|
@ -516,7 +516,7 @@ describe(
|
|||
|
||||
if (includes(typesContainPasswordManagerInfoLinks, type)) {
|
||||
it(
|
||||
'password manager info link is in email template output for ' + type,
|
||||
`password manager info link is in email template output for ${ type}`,
|
||||
() => {
|
||||
const passwordManagerInfoUrl = mailer._generateLinks(config.get('smtp').passwordManagerInfoUrl, message.email, {}, type).passwordManagerInfoUrl;
|
||||
|
||||
|
@ -532,7 +532,7 @@ describe(
|
|||
}
|
||||
|
||||
if (includes(typesContainManageSettingsLinks, type)) {
|
||||
it('account settings info link is in email template output for ' + type, () => {
|
||||
it(`account settings info link is in email template output for ${ type}`, () => {
|
||||
const accountSettingsUrl = mailer._generateSettingLinks(message, type).link;
|
||||
|
||||
mailer.mailer.sendMail = stubSendMail(emailConfig => {
|
||||
|
@ -546,7 +546,7 @@ describe(
|
|||
}
|
||||
|
||||
if (includes(typesContainRecoveryCodeLinks, type)) {
|
||||
it('recovery code settings info link is in email template output for ' + type, () => {
|
||||
it(`recovery code settings info link is in email template output for ${ type}`, () => {
|
||||
const url = mailer._generateLowRecoveryCodesLinks(message, type).link;
|
||||
|
||||
mailer.mailer.sendMail = stubSendMail(emailConfig => {
|
||||
|
@ -569,7 +569,7 @@ describe(
|
|||
|
||||
if (type === 'verifySecondaryEmail') {
|
||||
it(
|
||||
'original user email data is in template for ' + type,
|
||||
`original user email data is in template for ${ type}`,
|
||||
() => {
|
||||
const message = getLocationMessage(defaultLocation);
|
||||
message.primaryEmail = 'user@email.com';
|
||||
|
@ -585,7 +585,7 @@ describe(
|
|||
}
|
||||
|
||||
it(
|
||||
'ip data is in template for ' + type,
|
||||
`ip data is in template for ${ type}`,
|
||||
() => {
|
||||
const message = getLocationMessage(defaultLocation);
|
||||
|
||||
|
@ -599,21 +599,21 @@ describe(
|
|||
);
|
||||
|
||||
it(
|
||||
'location is correct with city, country, stateCode for ' + type,
|
||||
`location is correct with city, country, stateCode for ${ type}`,
|
||||
() => {
|
||||
const location = defaultLocation;
|
||||
const message = getLocationMessage(defaultLocation);
|
||||
|
||||
mailer.mailer.sendMail = stubSendMail(emailConfig => {
|
||||
assert.ok(includes(emailConfig.html, location.city + ', ' + location.stateCode + ', ' + location.country));
|
||||
assert.ok(includes(emailConfig.text, location.city + ', ' + location.stateCode + ', ' + location.country));
|
||||
assert.ok(includes(emailConfig.html, `${location.city }, ${ location.stateCode }, ${ location.country}`));
|
||||
assert.ok(includes(emailConfig.text, `${location.city }, ${ location.stateCode }, ${ location.country}`));
|
||||
});
|
||||
return mailer[type](message);
|
||||
}
|
||||
);
|
||||
|
||||
it(
|
||||
'location is correct with city, country for ' + type,
|
||||
`location is correct with city, country for ${ type}`,
|
||||
() => {
|
||||
const location = Object.assign({}, defaultLocation);
|
||||
delete location.stateCode;
|
||||
|
@ -621,30 +621,30 @@ describe(
|
|||
|
||||
|
||||
mailer.mailer.sendMail = stubSendMail(emailConfig => {
|
||||
assert.ok(includes(emailConfig.html, location.city + ', ' + location.country));
|
||||
assert.ok(includes(emailConfig.text, location.city + ', ' + location.country));
|
||||
assert.ok(includes(emailConfig.html, `${location.city }, ${ location.country}`));
|
||||
assert.ok(includes(emailConfig.text, `${location.city }, ${ location.country}`));
|
||||
});
|
||||
return mailer[type](message);
|
||||
}
|
||||
);
|
||||
|
||||
it(
|
||||
'location is correct with stateCode, country for ' + type,
|
||||
`location is correct with stateCode, country for ${ type}`,
|
||||
() => {
|
||||
const location = Object.assign({}, defaultLocation);
|
||||
delete location.city;
|
||||
const message = getLocationMessage(location);
|
||||
|
||||
mailer.mailer.sendMail = stubSendMail(emailConfig => {
|
||||
assert.ok(includes(emailConfig.html, location.stateCode + ', ' + location.country));
|
||||
assert.ok(includes(emailConfig.text, location.stateCode + ', ' + location.country));
|
||||
assert.ok(includes(emailConfig.html, `${location.stateCode }, ${ location.country}`));
|
||||
assert.ok(includes(emailConfig.text, `${location.stateCode }, ${ location.country}`));
|
||||
});
|
||||
return mailer[type](message);
|
||||
}
|
||||
);
|
||||
|
||||
it(
|
||||
'location is correct with country for ' + type,
|
||||
`location is correct with country for ${ type}`,
|
||||
() => {
|
||||
const location = Object.assign({}, defaultLocation);
|
||||
delete location.city;
|
||||
|
@ -661,7 +661,7 @@ describe(
|
|||
);
|
||||
|
||||
it(
|
||||
'device name is correct for ' + type,
|
||||
`device name is correct for ${ type}`,
|
||||
() => {
|
||||
const message = getLocationMessage(defaultLocation);
|
||||
message.uaBrowser = 'Firefox';
|
||||
|
@ -767,7 +767,7 @@ describe(
|
|||
);
|
||||
} else if (type === 'postVerifyEmail') {
|
||||
it(
|
||||
'test utm params for ' + type,
|
||||
`test utm params for ${ type}`,
|
||||
() => {
|
||||
const syncLink = mailer._generateUTMLink(config.get('smtp').syncUrl, {}, type, 'connect-device');
|
||||
const androidLink = mailer._generateUTMLink(config.get('smtp').androidUrl, {}, type, 'connect-android');
|
||||
|
|
|
@ -22,17 +22,17 @@ describe('lib/senders/index', () => {
|
|||
describe('email', () => {
|
||||
|
||||
const UID = crypto.randomBytes(16);
|
||||
const EMAIL = crypto.randomBytes(16).toString('hex') + '@example.test';
|
||||
const EMAIL = `${crypto.randomBytes(16).toString('hex') }@example.test`;
|
||||
const EMAILS = [{
|
||||
email: EMAIL,
|
||||
isPrimary: true,
|
||||
isVerified: true
|
||||
}, {
|
||||
email: crypto.randomBytes(16).toString('hex') + '@example.test',
|
||||
email: `${crypto.randomBytes(16).toString('hex') }@example.test`,
|
||||
isPrimary: false,
|
||||
isVerified: true
|
||||
}, {
|
||||
email: crypto.randomBytes(16).toString('hex') + '@example.test',
|
||||
email: `${crypto.randomBytes(16).toString('hex') }@example.test`,
|
||||
isPrimary: false,
|
||||
isVerified: false
|
||||
}];
|
||||
|
|
|
@ -37,7 +37,7 @@ module.exports = function (host, port, printLogs) {
|
|||
}
|
||||
|
||||
function loop(name, tries, cb) {
|
||||
const url = 'http://' + host + ':' + port + '/mail/' + encodeURIComponent(name);
|
||||
const url = `http://${ host }:${ port }/mail/${ encodeURIComponent(name)}`;
|
||||
log('checking mail', url);
|
||||
request({ url: url, method: 'GET' },
|
||||
(err, res, body) => {
|
||||
|
@ -57,7 +57,7 @@ module.exports = function (host, port, printLogs) {
|
|||
|
||||
if (! json) {
|
||||
if (tries === 0) {
|
||||
return cb(new Error('could not get mail for ' + url));
|
||||
return cb(new Error(`could not get mail for ${ url}`));
|
||||
}
|
||||
return setTimeout(loop.bind(null, name, --tries, cb), 1000);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ const zeroBuffer32 = Buffer.from('0000000000000000000000000000000000000000000000
|
|||
function createTestAccount() {
|
||||
const account = {
|
||||
uid: uuid.v4('binary').toString('hex'),
|
||||
email: 'foo' + Math.random() + '@bar.com',
|
||||
email: `foo${ Math.random() }@bar.com`,
|
||||
emailCode: zeroBuffer16,
|
||||
emailVerified: false,
|
||||
verifierVersion: 1,
|
||||
|
|
|
@ -400,7 +400,7 @@ function mockDB (data, errors) {
|
|||
res.constructor.tokenTypeID = 'sessionToken';
|
||||
if (data.devices && data.devices.length > 0) {
|
||||
Object.keys(data.devices[0]).forEach(key => {
|
||||
const keyOnSession = 'device' + key.charAt(0).toUpperCase() + key.substr(1);
|
||||
const keyOnSession = `device${ key.charAt(0).toUpperCase() }${key.substr(1)}`;
|
||||
res[keyOnSession] = data.devices[0][key];
|
||||
});
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ PushManager.prototype.getSubscription = function getSubscription() {
|
|||
ws.close();
|
||||
},
|
||||
'': function(data) {
|
||||
onError(new Error('Unexpected ws message: ' + JSON.stringify(data)));
|
||||
onError(new Error(`Unexpected ws message: ${ JSON.stringify(data)}`));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ describe('remote account locale', function() {
|
|||
config.publicUrl,
|
||||
email,
|
||||
password,
|
||||
{ lang: 'en-US,en;q=0.8,' + Buffer.alloc(128).toString('hex') }
|
||||
{ lang: `en-US,en;q=0.8,${ Buffer.alloc(128).toString('hex')}` }
|
||||
)
|
||||
.then(
|
||||
(c) => {
|
||||
|
|
|
@ -32,7 +32,7 @@ describe('remote account login', () => {
|
|||
return Client.createAndVerify(config.publicUrl, email, password, server.mailbox)
|
||||
.then(
|
||||
() => {
|
||||
return Client.login(config.publicUrl, email, password + 'x');
|
||||
return Client.login(config.publicUrl, email, `${password }x`);
|
||||
}
|
||||
)
|
||||
.then(
|
||||
|
|
|
@ -12,7 +12,7 @@ const config = require('../../config').getProperties();
|
|||
|
||||
function makeMockOAuthHeader(opts) {
|
||||
const token = Buffer.from(JSON.stringify(opts)).toString('hex');
|
||||
return 'Bearer ' + token;
|
||||
return `Bearer ${ token}`;
|
||||
}
|
||||
|
||||
describe('remote account profile', function() {
|
||||
|
|
|
@ -268,7 +268,7 @@ describe('remote account signin verification', function() {
|
|||
const password = 'something';
|
||||
let client = null;
|
||||
const options = {
|
||||
redirectTo: 'https://sync.' + config.smtp.redirectDomain,
|
||||
redirectTo: `https://sync.${ config.smtp.redirectDomain}`,
|
||||
service: 'sync',
|
||||
resume: 'resumeToken',
|
||||
keys: true
|
||||
|
@ -311,7 +311,7 @@ describe('remote account signin verification', function() {
|
|||
let client = null;
|
||||
let client2 = null;
|
||||
const options = {
|
||||
redirectTo: 'https://sync.' + config.smtp.redirectDomain,
|
||||
redirectTo: `https://sync.${ config.smtp.redirectDomain}`,
|
||||
service: 'sync',
|
||||
resume: 'resumeToken',
|
||||
keys: true
|
||||
|
|
|
@ -42,7 +42,7 @@ describe('remote base path', function() {
|
|||
it(
|
||||
'alternate base path',
|
||||
() => {
|
||||
const email = Math.random() + '@example.com';
|
||||
const email = `${Math.random() }@example.com`;
|
||||
const password = 'ok';
|
||||
// if this doesn't crash, we're all good
|
||||
return Client.create(config.publicUrl, email, password, server.mailbox);
|
||||
|
|
|
@ -227,7 +227,7 @@ describe('remote certificate sign', function() {
|
|||
(token) => {
|
||||
return client.api.doRequest(
|
||||
'POST',
|
||||
client.api.baseURL + '/certificate/sign',
|
||||
`${client.api.baseURL }/certificate/sign`,
|
||||
token,
|
||||
{
|
||||
publicKey: publicKey,
|
||||
|
|
|
@ -357,7 +357,7 @@ describe('remote db', function() {
|
|||
}, err => {
|
||||
assert.equal(err.errno, 110, 'sessionToken() fails with the correct error code');
|
||||
const msg = 'Error: The authentication token could not be found';
|
||||
assert.equal(msg, '' + err, 'sessionToken() fails with the correct message');
|
||||
assert.equal(msg, `${ err}`, 'sessionToken() fails with the correct message');
|
||||
});
|
||||
})
|
||||
.then(() => {
|
||||
|
@ -674,7 +674,7 @@ describe('remote db', function() {
|
|||
}, (err) => {
|
||||
assert.equal(err.errno, 110, 'keyFetchToken() fails with the correct error code');
|
||||
const msg = 'Error: The authentication token could not be found';
|
||||
assert.equal(msg, '' + err, 'keyFetchToken() fails with the correct message');
|
||||
assert.equal(msg, `${ err}`, 'keyFetchToken() fails with the correct message');
|
||||
});
|
||||
}
|
||||
);
|
||||
|
@ -712,7 +712,7 @@ describe('remote db', function() {
|
|||
.then(assert.fail, (err) => {
|
||||
assert.equal(err.errno, 110, 'accountResetToken() fails with the correct error code');
|
||||
const msg = 'Error: The authentication token could not be found';
|
||||
assert.equal(msg, '' + err, 'accountResetToken() fails with the correct message');
|
||||
assert.equal(msg, `${ err}`, 'accountResetToken() fails with the correct message');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -763,7 +763,7 @@ describe('remote db', function() {
|
|||
}, (err) => {
|
||||
assert.equal(err.errno, 110, 'passwordForgotToken() fails with the correct error code');
|
||||
const msg = 'Error: The authentication token could not be found';
|
||||
assert.equal(msg, '' + err, 'passwordForgotToken() fails with the correct message');
|
||||
assert.equal(msg, `${ err}`, 'passwordForgotToken() fails with the correct message');
|
||||
});
|
||||
}
|
||||
);
|
||||
|
@ -905,7 +905,7 @@ describe('remote db', function() {
|
|||
(err) => {
|
||||
assert.equal(err.errno, 127, 'consumeUnblockCode() fails with the correct error code');
|
||||
const msg = 'Error: Invalid unblock code';
|
||||
assert.equal(msg, '' + err, 'consumeUnblockCode() fails with the correct message');
|
||||
assert.equal(msg, `${ err}`, 'consumeUnblockCode() fails with the correct message');
|
||||
}
|
||||
)
|
||||
.then(
|
||||
|
@ -928,7 +928,7 @@ describe('remote db', function() {
|
|||
(err) => {
|
||||
assert.equal(err.errno, 127, 'consumeUnblockCode() fails with the correct error code');
|
||||
const msg = 'Error: Invalid unblock code';
|
||||
assert.equal(msg, '' + err, 'consumeUnblockCode() fails with the correct message');
|
||||
assert.equal(msg, `${ err}`, 'consumeUnblockCode() fails with the correct message');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -62,8 +62,8 @@ describe('remote email validity', function() {
|
|||
'tim@tim-example.net',
|
||||
'a+b+c@example.com',
|
||||
'#!?-@t-e-s-assert.c-o-m',
|
||||
String.fromCharCode(1234) + '@example.com',
|
||||
'test@' + String.fromCharCode(5678) + '.com'
|
||||
`${String.fromCharCode(1234) }@example.com`,
|
||||
`test@${ String.fromCharCode(5678) }.com`
|
||||
];
|
||||
|
||||
emails.forEach((email, i) => {
|
||||
|
@ -73,7 +73,7 @@ describe('remote email validity', function() {
|
|||
return c.destroyAccount();
|
||||
},
|
||||
(err) => {
|
||||
assert(false, 'Email address ' + email + " should have been allowed, but it wasn't");
|
||||
assert(false, `Email address ${ email } should have been allowed, but it wasn't`);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
|
|
@ -43,7 +43,7 @@ describe('remote misc', function() {
|
|||
|
||||
return () => {
|
||||
const options = {
|
||||
url: config.publicUrl + '/'
|
||||
url: `${config.publicUrl }/`
|
||||
};
|
||||
if (withAllowedOrigin !== undefined) {
|
||||
options.headers = {
|
||||
|
@ -59,7 +59,7 @@ describe('remote misc', function() {
|
|||
it(
|
||||
'unsupported api version',
|
||||
() => {
|
||||
return request(config.publicUrl + '/v0/account/create').spread((res) => {
|
||||
return request(`${config.publicUrl }/v0/account/create`).spread((res) => {
|
||||
assert.equal(res.statusCode, 410, 'http gone');
|
||||
});
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ describe('remote misc', function() {
|
|||
it(
|
||||
'/__heartbeat__ returns a 200 OK',
|
||||
() => {
|
||||
return request(config.publicUrl + '/__heartbeat__').spread((res) => {
|
||||
return request(`${config.publicUrl }/__heartbeat__`).spread((res) => {
|
||||
assert.equal(res.statusCode, 200, 'http ok');
|
||||
});
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ describe('remote misc', function() {
|
|||
it(
|
||||
'/__lbheartbeat__ returns a 200 OK',
|
||||
() => {
|
||||
return request(config.publicUrl + '/__lbheartbeat__').spread((res) => {
|
||||
return request(`${config.publicUrl }/__lbheartbeat__`).spread((res) => {
|
||||
assert.equal(res.statusCode, 200, 'http ok');
|
||||
});
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ describe('remote misc', function() {
|
|||
)
|
||||
.then(
|
||||
() => {
|
||||
url = client.api.baseURL + '/account/keys';
|
||||
url = `${client.api.baseURL }/account/keys`;
|
||||
return client.api.Token.KeyFetchToken.fromHex(client.keyFetchToken);
|
||||
}
|
||||
)
|
||||
|
@ -192,7 +192,7 @@ describe('remote misc', function() {
|
|||
() => {
|
||||
return request(
|
||||
{
|
||||
url: config.publicUrl + '/'
|
||||
url: `${config.publicUrl }/`
|
||||
})
|
||||
.spread((res, body) => {
|
||||
assert.equal(res.headers['strict-transport-security'], 'max-age=15552000; includeSubDomains');
|
||||
|
@ -206,7 +206,7 @@ describe('remote misc', function() {
|
|||
const client = new Client(config.publicUrl);
|
||||
return client.api.doRequest(
|
||||
'POST',
|
||||
client.api.baseURL + '/get_random_bytes',
|
||||
`${client.api.baseURL }/get_random_bytes`,
|
||||
null,
|
||||
// See payload.maxBytes in ../../server/server.js
|
||||
{ big: Buffer.alloc(8192).toString('hex')}
|
||||
|
@ -276,7 +276,7 @@ describe('remote misc', function() {
|
|||
return client.api.Token.SessionToken.fromHex(client.sessionToken);
|
||||
})
|
||||
.then((token) => {
|
||||
url = client.api.baseURL + '/account/device';
|
||||
url = `${client.api.baseURL }/account/device`;
|
||||
const method = 'POST';
|
||||
const payload = {
|
||||
name: 'my cool device',
|
||||
|
|
|
@ -217,7 +217,7 @@ describe('remote password forgot', function() {
|
|||
const password = 'something';
|
||||
let client = null;
|
||||
const options = {
|
||||
redirectTo: 'https://sync.' + config.smtp.redirectDomain + '/',
|
||||
redirectTo: `https://sync.${ config.smtp.redirectDomain }/`,
|
||||
service: 'sync'
|
||||
};
|
||||
return Client.create(config.publicUrl, email, password, options)
|
||||
|
@ -350,7 +350,7 @@ describe('remote password forgot', function() {
|
|||
() => {
|
||||
const email = server.uniqueEmail();
|
||||
const options = {
|
||||
redirectTo: 'https://sync.' + config.smtp.redirectDomain + '/',
|
||||
redirectTo: `https://sync.${ config.smtp.redirectDomain }/`,
|
||||
serviceQuery: 'sync'
|
||||
};
|
||||
let client;
|
||||
|
|
|
@ -27,7 +27,7 @@ const zeroBuffer32 = Buffer.from('0000000000000000000000000000000000000000000000
|
|||
const SESSION_TOKEN_UA = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:41.0) Gecko/20100101 Firefox/41.0';
|
||||
const ACCOUNT = {
|
||||
uid: uuid.v4('binary').toString('hex'),
|
||||
email: 'push' + Math.random() + '@bar.com',
|
||||
email: `push${ Math.random() }@bar.com`,
|
||||
emailCode: zeroBuffer16,
|
||||
emailVerified: false,
|
||||
verifierVersion: 1,
|
||||
|
|
|
@ -267,7 +267,7 @@ describe('remote emails', function () {
|
|||
assert.equal(templateName, 'verifySecondaryEmail', 'email template name set');
|
||||
|
||||
assert.equal(includes(verifyLink, 'type=secondary'), true, 'contains type=secondary');
|
||||
const secondaryEmailParam = 'secondary_email_verified=' + encodeURIComponent(secondEmail);
|
||||
const secondaryEmailParam = `secondary_email_verified=${ encodeURIComponent(secondEmail)}`;
|
||||
assert.equal(includes(verifyLink, secondaryEmailParam), true, 'contains correct secondary_email_verified');
|
||||
|
||||
assert.ok(emailCode, 'emailCode set');
|
||||
|
|
|
@ -30,7 +30,7 @@ describe('remote recovery email resend code', function () {
|
|||
let verifyEmailCode = '';
|
||||
let client = null;
|
||||
const options = {
|
||||
redirectTo: 'https://sync.' + config.smtp.redirectDomain,
|
||||
redirectTo: `https://sync.${ config.smtp.redirectDomain}`,
|
||||
service: 'sync',
|
||||
resume: 'resumeToken',
|
||||
keys: true
|
||||
|
@ -69,7 +69,7 @@ describe('remote recovery email resend code', function () {
|
|||
let verifyEmailCode = '';
|
||||
let client2 = null;
|
||||
const options = {
|
||||
redirectTo: 'https://sync.' + config.smtp.redirectDomain,
|
||||
redirectTo: `https://sync.${ config.smtp.redirectDomain}`,
|
||||
service: 'sync',
|
||||
resume: 'resumeToken',
|
||||
keys: true
|
||||
|
|
|
@ -76,7 +76,7 @@ describe('remote recovery email verify', function() {
|
|||
const password = 'something';
|
||||
let client = null; // eslint-disable-line no-unused-vars
|
||||
const options = {
|
||||
redirectTo: 'https://sync.' + config.smtp.redirectDomain + '/',
|
||||
redirectTo: `https://sync.${ config.smtp.redirectDomain }/`,
|
||||
service: 'sync'
|
||||
};
|
||||
return Client.create(config.publicUrl, email, password, options)
|
||||
|
|
|
@ -27,7 +27,7 @@ describe('remote token expiry', function() {
|
|||
'token expiry',
|
||||
() => {
|
||||
// FYI config.tokenLifetimes.passwordChangeToken = 1
|
||||
const email = Math.random() + '@example.com';
|
||||
const email = `${Math.random() }@example.com`;
|
||||
const password = 'ok';
|
||||
return Client.create(config.publicUrl, email, password, { preVerified: true })
|
||||
.then(
|
||||
|
|
|
@ -39,7 +39,7 @@ describe('remote verifier upgrade', function() {
|
|||
db_server.listen(config.httpdb.url.split(':')[2]);
|
||||
db_server.on('error', () => {});
|
||||
|
||||
const email = Math.random() + '@example.com';
|
||||
const email = `${Math.random() }@example.com`;
|
||||
const password = 'ok';
|
||||
let uid = null;
|
||||
|
||||
|
|
|
@ -104,11 +104,11 @@ TestServer.prototype.uniqueEmail = function (domain) {
|
|||
};
|
||||
|
||||
TestServer.prototype.uniqueUnicodeEmail = function () {
|
||||
return crypto.randomBytes(10).toString('hex') +
|
||||
String.fromCharCode(1234) +
|
||||
'@' +
|
||||
String.fromCharCode(5678) +
|
||||
'restmail.net';
|
||||
return `${crypto.randomBytes(10).toString('hex') +
|
||||
String.fromCharCode(1234)
|
||||
}@${
|
||||
String.fromCharCode(5678)
|
||||
}restmail.net`;
|
||||
};
|
||||
|
||||
module.exports = TestServer;
|
||||
|
|
Загрузка…
Ссылка в новой задаче