Mail scheme updated v2

This commit is contained in:
salvacybersec
2025-11-11 04:09:45 +03:00
parent 06136294da
commit fa6259e0bd
3 changed files with 89 additions and 51 deletions

View File

@@ -65,13 +65,14 @@ exports.getTokenById = async (req, res, next) => {
// Create token (without sending mail)
exports.createToken = async (req, res, next) => {
try {
const { company_id, target_email, employee_name, template_type } = req.body;
const { company_id, target_email, employee_name, template_type, from_name } = req.body;
const token = await tokenService.createToken({
company_id,
target_email,
employee_name,
template_type,
from_name,
});
const trackingUrl = `${process.env.BASE_URL}/t/${token.token}`;
@@ -92,7 +93,7 @@ exports.createToken = async (req, res, next) => {
// Create token and send mail
exports.createAndSendToken = async (req, res, next) => {
try {
const { company_id, target_email, employee_name, template_type } = req.body;
const { company_id, target_email, employee_name, template_type, from_name } = req.body;
// Create token
const token = await tokenService.createToken({
@@ -100,6 +101,7 @@ exports.createAndSendToken = async (req, res, next) => {
target_email,
employee_name,
template_type,
from_name,
});
// Send mail