modif sqendmail to manage change in askregistertemplate
This commit is contained in:
parent
25a561d4ef
commit
4683216987
@ -74,15 +74,49 @@ router.post(
|
|||||||
checkHeaders,
|
checkHeaders,
|
||||||
isAuthenticated,
|
isAuthenticated,
|
||||||
async (req, res) => {
|
async (req, res) => {
|
||||||
const data = req.body.data;
|
// add accessright restriction here
|
||||||
data.emailsto = req.body.emails;
|
/*const data = req.body.data;
|
||||||
|
data.emailsto = { to: req.body.emails };
|
||||||
|
|
||||||
const pathtpl = `../${req.params.tribe}/template/${req.params.template}_${req.session.header.xlang}.js`;
|
const pathtpl = `../${req.params.tribe}/template/${req.params.template}_${req.session.header.xlang}.js`;
|
||||||
|
const campain = { emailsto: [] };
|
||||||
const sendemail = await Notifications.manageemail(
|
const sendemail = await Notifications.manageemail(
|
||||||
data,
|
data,
|
||||||
pathtpl,
|
pathtpl,
|
||||||
req.params.tribe
|
req.params.tribe
|
||||||
|
);*/
|
||||||
|
let sendret;
|
||||||
|
if (req.body.emailsto && req.body.emailsto.length > 0) {
|
||||||
|
const sendcampain = Notifications.manageeamil(
|
||||||
|
req.body.emailsto,
|
||||||
|
req.params.template,
|
||||||
|
tribe,
|
||||||
|
req.session.header.xlang,
|
||||||
|
1
|
||||||
);
|
);
|
||||||
res.status(sendemail.status).send(sendemail);
|
sendret = sendcampain;
|
||||||
|
} else if (req.body.emails) {
|
||||||
|
// To delete when Bhavesh removed direct email to send requesting registration
|
||||||
|
const campain = {
|
||||||
|
emailsto: [
|
||||||
|
{
|
||||||
|
to: req.body.emails,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
Object.keys(req.body).forEach(k=>{
|
||||||
|
const newk= (k=="Cc")?"cc":k;
|
||||||
|
campain.emailsto[0][newk]=req.body[k]
|
||||||
|
})
|
||||||
|
sendret = Notifications.manageemail(
|
||||||
|
campain,
|
||||||
|
req.params.template,
|
||||||
|
tribe,
|
||||||
|
req.session.header.xlang,
|
||||||
|
1
|
||||||
|
);
|
||||||
|
}
|
||||||
|
res.status(sendret.status).send(sendret);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user