You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
945 B
27 lines
945 B
|
4 years ago
|
import path from 'path';
|
||
|
|
import { fileURLToPath } from 'url';
|
||
|
|
import { EmailConfig } from '../../config/email.config.js';
|
||
|
|
import { minutes } from '../utils/common.utils.js';
|
||
|
|
import { TemplateFile, TranslationFile } from '../utils/localization.utils.js';
|
||
|
|
|
||
|
|
export const RestorePasswordEmail = ({username, locale, url}) => {
|
||
|
|
const subject = translation.get('email.restore.subject', locale);
|
||
|
|
const bodyText = translation.get('email.restore.body', locale, {username, url});
|
||
|
|
return {
|
||
|
|
subject,
|
||
|
|
text: bodyText,
|
||
|
|
html: templates.wrapper.generate({...common, body: bodyText})
|
||
|
|
};
|
||
|
|
};
|
||
|
|
|
||
|
|
const common = {
|
||
|
|
title: EmailConfig.upperText,
|
||
|
|
company: EmailConfig.bottomText
|
||
|
|
};
|
||
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||
|
|
const refreshRate = 60*minutes;
|
||
|
|
const translation = new TranslationFile(__dirname+'/texts.json', refreshRate);
|
||
|
|
const templates = {
|
||
|
|
wrapper: new TemplateFile(__dirname+'/wrapper.html', refreshRate, {html: true})
|
||
|
|
};
|