feat: add messaging toggles, password reset SMS, and payment discounts
Allow SuperAdmin to disable SMS, email, and bot from dashboard settings on top of env flags. Add admin password reset with credentials SMS, plus payment discounts, notes, and payable amount handling.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
const nodemailer = require('nodemailer');
|
||||
const config = require('../../config/config');
|
||||
const logger = require('../logger');
|
||||
const { isMessagingChannelEnabled } = require('../../components/settings/messagingFlags');
|
||||
|
||||
let transporter = null;
|
||||
|
||||
@@ -25,6 +26,11 @@ const sendEmail = async ({ to, subject, body, html }) => {
|
||||
try {
|
||||
if (!to) throw new Error('Recipient email is required');
|
||||
|
||||
if (!(await isMessagingChannelEnabled('email'))) {
|
||||
logger.info(`[EmailSender] Skipped (channel disabled) → ${to}`);
|
||||
return { skipped: true, reason: 'channel_disabled' };
|
||||
}
|
||||
|
||||
const mailOptions = {
|
||||
from: config.EMAIL_FROM,
|
||||
to,
|
||||
|
||||
Reference in New Issue
Block a user