mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
167 lines
8.3 KiB
JavaScript
167 lines
8.3 KiB
JavaScript
/***********************************************************************************************************************************************************************
|
|
* File Name: email_body.data.js
|
|
* Type of Program: Data
|
|
* Description: Hardcoded subject/body per email type, keyed by the `type`
|
|
* string passed to services/email.service.js's sendEmail(). To
|
|
* add or edit an email, edit the template function here directly
|
|
* and redeploy — there is no admin UI or DB table for this.
|
|
* Author: rgrgogu, Kenneth Obsequio (@lash0000)
|
|
* Date Created: Oct. 6, 2025
|
|
***********************************************************************************************************************************************************************/
|
|
const FONT = 'font-family: Arial, sans-serif; font-size: 14px; color: #000;';
|
|
|
|
const wrap = (body) => `
|
|
<html>
|
|
<body style="${FONT} line-height: 1.6;">
|
|
${body.trim()}
|
|
<br><br>
|
|
<p style="margin: 0;">Regards,<br>Philproperties IT Team</p>
|
|
<p style="margin: 0; font-size: 12px; color: #555;">This is an automated message from STARR System. Please do not reply.</p>
|
|
</body>
|
|
</html>`.trim();
|
|
|
|
const emailTemplates = {
|
|
OTP: ({ otp, expiryMinutes = 10 }) => ({
|
|
subject: "Email OTP Verification - STARR System",
|
|
html: wrap(`
|
|
<p>Dear User,</p>
|
|
<p>Please use the One-Time Password (OTP) below to verify your email address. This code is valid for <strong>${expiryMinutes} minutes</strong>.</p>
|
|
<p style="font-size: 28px; font-weight: bold; letter-spacing: 6px;">${otp}</p>
|
|
<p>For security reasons, please do not share this code with anyone. If you did not request this, please contact the administrator.</p>
|
|
`),
|
|
}),
|
|
|
|
LOGIN_OTP: ({ otp, expiryMinutes = 10 }) => ({
|
|
subject: "Sign-In Verification Code - STARR System",
|
|
html: wrap(`
|
|
<p>Dear User,</p>
|
|
<p>Use the One-Time Password (OTP) below to confirm this sign-in. This code is valid for <strong>${expiryMinutes} minutes</strong>.</p>
|
|
<p style="font-size: 28px; font-weight: bold; letter-spacing: 6px;">${otp}</p>
|
|
<p>For security reasons, please do not share this code with anyone. If you did not attempt to log in, please contact the administrator.</p>
|
|
`),
|
|
}),
|
|
|
|
RESET_PASSWORD_OTP: ({ otp, expiryMinutes = 10 }) => ({
|
|
subject: "Password Reset Code - STARR System",
|
|
html: wrap(`
|
|
<p>Dear User,</p>
|
|
<p>Use the One-Time Password (OTP) below to reset your account password. This code is valid for <strong>${expiryMinutes} minutes</strong>.</p>
|
|
<p style="font-size: 28px; font-weight: bold; letter-spacing: 6px;">${otp}</p>
|
|
<p>For security reasons, please do not share this code with anyone. If you did not request a password reset, please ignore this email or contact the administrator.</p>
|
|
`),
|
|
}),
|
|
|
|
WELCOME: ({ name }) => ({
|
|
subject: "Welcome to STARR System",
|
|
html: wrap(`
|
|
<p>Dear ${name},</p>
|
|
<p>We are pleased to welcome you to the STARR System. Your account has been successfully created and is now ready for use.</p>
|
|
<p>You may now access your dashboard and begin using the available services.</p>
|
|
<p>We look forward to supporting you.</p>
|
|
`),
|
|
}),
|
|
|
|
PASSWORD_CHANGED: () => ({
|
|
subject: "Password Update Confirmation - STARR System",
|
|
html: wrap(`
|
|
<p>Dear User,</p>
|
|
<p>This is to confirm that your account password has been successfully changed.</p>
|
|
<p>If you did not perform this action, please reset your password immediately or contact support.</p>
|
|
<p>For your security, we recommend using a strong and unique password.</p>
|
|
`),
|
|
}),
|
|
|
|
ADDED_TO_GROUP: ({ groupName }) => ({
|
|
subject: "Group Assignment Notification - STARR System",
|
|
html: wrap(`
|
|
<p>Dear User,</p>
|
|
<p>You have been assigned to the group <strong>${groupName}</strong> in the STARR System.</p>
|
|
<p>This assignment grants you access to shared resources and collaboration tools within the group.</p>
|
|
<p>Please log in to your account to view group details.</p>
|
|
`),
|
|
}),
|
|
|
|
TASK_ASSIGNED: ({ taskTitle, dueDate }) => ({
|
|
subject: "New Task Assignment - STARR System",
|
|
html: wrap(`
|
|
<p>Dear User,</p>
|
|
<p>You have been assigned a new task in the STARR System.</p>
|
|
<table style="${FONT}">
|
|
<tr><td><strong>Task</strong></td><td>${taskTitle}</td></tr>
|
|
<tr><td><strong>Due Date</strong></td><td>${dueDate}</td></tr>
|
|
</table>
|
|
<p>Kindly ensure completion within the specified timeframe.</p>
|
|
`),
|
|
}),
|
|
|
|
BAN_LIFTED: ({ name, email, date }) => ({
|
|
subject: "Account Suspension Lifted - STARR System",
|
|
html: wrap(`
|
|
<p>Dear ${name},</p>
|
|
<p>We are writing to inform you that the suspension on your account (<strong>${email}</strong>) has been lifted effective <strong>${date}</strong>.</p>
|
|
<p>You may now log in and resume access to all services within the STARR System.</p>
|
|
<p>If you have any concerns, please do not hesitate to contact your administrator.</p>
|
|
`),
|
|
}),
|
|
|
|
BANNED: ({ name, email, date, reason, ban_type }) => ({
|
|
subject: "Account Suspension Notice - STARR System",
|
|
html: wrap(`
|
|
<p>Dear ${name},</p>
|
|
<p>Your account (<strong>${email}</strong>) has been ${ban_type === 'permanent' ? 'permanently' : 'temporarily'} suspended from the STARR System effective <strong>${date}</strong>.</p>
|
|
<table style="${FONT}">
|
|
<tr><td><strong>Reason</strong></td><td>${reason}</td></tr>
|
|
<tr><td><strong>Duration</strong></td><td>${ban_type === 'permanent' ? 'Permanent' : 'Temporary'}</td></tr>
|
|
</table>
|
|
<p>During this period, access to all system services has been revoked.${ban_type === 'permanent' ? '' : ' This suspension may be lifted upon review by the administrator.'}</p>
|
|
<p>If you believe this was made in error, please contact your administrator.</p>
|
|
`),
|
|
}),
|
|
|
|
MADE_ADMIN: ({ name, email }) => ({
|
|
subject: "You've Been Granted Administrator Access - STARR System",
|
|
html: wrap(`
|
|
<p>Dear ${name},</p>
|
|
<p><strong>Congratulations!</strong></p>
|
|
<p>We're pleased to inform you that your account has been granted Administrator access to the platform.</p>
|
|
<p>As an Administrator, you now have access to management features that allow you to oversee users, courses, content, and other administrative functions.</p>
|
|
<table style="${FONT}">
|
|
<tr><td><strong>Email</strong></td><td>${email}</td></tr>
|
|
<tr><td><strong>Role</strong></td><td>Administrator</td></tr>
|
|
</table>
|
|
<p>Please sign in using your existing credentials. If you have any questions or require assistance, don't hesitate to contact our support team.</p>
|
|
`),
|
|
}),
|
|
|
|
DEMOTED_ADMIN: ({ name, email }) => ({
|
|
subject: "Your Account Role Has Been Updated - STARR System",
|
|
html: wrap(`
|
|
<p>Dear ${name},</p>
|
|
<p>This email is to inform you that your account has been updated.</p>
|
|
<p>Your Administrator privileges have been removed, and your account has been returned to a User role.</p>
|
|
<table style="${FONT}">
|
|
<tr><td><strong>Email</strong></td><td>${email}</td></tr>
|
|
<tr><td><strong>Current Role</strong></td><td>User</td></tr>
|
|
</table>
|
|
<p>You can continue using the platform with the permissions available to standard users. If you believe this change was made in error or have any questions, please contact your system administrator.</p>
|
|
`),
|
|
}),
|
|
|
|
ADD_STAFF: ({ name, email, password, expiryHours = 24 }) => ({
|
|
subject: "Your Staff Account Has Been Created - STARR System",
|
|
html: wrap(`
|
|
<p>Dear ${name},</p>
|
|
<p>Your staff account has been successfully created in the STARR System. Below are your login credentials:</p>
|
|
<table style="${FONT}">
|
|
<tr><td><strong>Email</strong></td><td>${email}</td></tr>
|
|
<tr><td><strong>Password</strong></td><td>${password}</td></tr>
|
|
</table>
|
|
<p>This temporary password is valid for <strong>${expiryHours} hours</strong>. You will be required to change it upon first login.</p>
|
|
<p>If you did not request this account or believe this was created in error, please contact your administrator immediately to have it deactivated.</p>
|
|
<p>For security, please do not share your credentials with anyone. If you need a new password, contact your administrator.</p>
|
|
`),
|
|
}),
|
|
};
|
|
|
|
module.exports = { emailTemplates };
|