@coko/server
Version:
Reusable server for use by Coko's projects
110 lines (102 loc) • 3.46 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.passwordUpdate = exports.requestResetPassword = exports.requestResetPasswordEmailNotFound = exports.identityVerification = void 0;
const config_1 = __importDefault(require("../../configManager/config"));
const urls_1 = require("../../utils/urls");
/*
Email with email verification token to new users
*/
const identityVerification = (context) => {
const { verificationToken, email } = context;
const link = `${urls_1.clientUrl}/email-verification/${verificationToken}`;
const content = `
<p>Thank you for signing up!</p>
<p>Click on <a href="${link}">this link</a> to verify your account.</p>
<p></p>
<p>
If you cannot see the link, copy and paste the following link into your browser to verify your account.
<br/>
${link}
</p>
`;
const text = `
Thank you for signing up!\nCopy and paste the following link into your browser to verify your account.\n\n${link}`;
const data = {
content,
text,
subject: 'Account Verification',
to: email,
};
return data;
};
exports.identityVerification = identityVerification;
const passwordUpdate = (context) => {
const { email } = context;
const content = `
<p>
Your password has been successfully updated.
<br/>
If you did not initiate this change, please contact your system administrator.
</p>
`;
const data = {
subject: 'Password changed',
content,
to: email,
};
return data;
};
exports.passwordUpdate = passwordUpdate;
const requestResetPasswordEmailNotFound = (context) => {
const { email } = context;
const content = `
<p>
You or someone else tried to change the password of an account using this
email address.
<br/>
The requested change failed, as this email does not exist in our database.
<br/>
If this action was performed by you, please use the email address that
you have connected with your account.
</p>
`;
const data = {
content,
subject: 'Account access attempted',
to: email,
};
return data;
};
exports.requestResetPasswordEmailNotFound = requestResetPasswordEmailNotFound;
const requestResetPassword = (context) => {
const { email, token } = context;
const pathToPage = config_1.default.get('passwordResetRedirect');
const link = `${urls_1.clientUrl}${pathToPage}/${token}`;
const content = `
<p>
Follow the link below to reset your password.
<br/>
This link will be valid for 24 hours.
</p>
<p>
<a href="${link}">Reset your password</a>
</p>
<p>
If you cannot click the link above, paste the following into your
browser to continue: ${link}
</p>
`;
const text = `Paste the following link into your browser to reset your password.\n${link}\nThe link will be valid for 24 hours.`;
const data = {
subject: 'Password reset',
content,
text,
to: email,
};
return data;
};
exports.requestResetPassword = requestResetPassword;
//# sourceMappingURL=emailTemplates.js.map