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}) };