Prettified som more files and fixed some logging of missing files so they are more similar in fashion

This commit is contained in:
Kasper Rynning-Tønnesen
2019-07-26 08:46:03 +02:00
parent 6369c55252
commit 6ed67ffee6
18 changed files with 5629 additions and 3697 deletions

View File

@@ -1,39 +1,48 @@
var path = require('path');
var path = require("path");
function requested_change(type, string, channel) {
try {
//channel = channel.replace(/ /g,'');
var nodemailer = require('nodemailer');
var mailconfig = require(path.join(__dirname, '../config/mailconfig.js'));
try {
//channel = channel.replace(/ /g,'');
var nodemailer = require("nodemailer");
var mailconfig = require(path.join(__dirname, "../config/mailconfig.js"));
let transporter = nodemailer.createTransport(mailconfig);
let transporter = nodemailer.createTransport(mailconfig);
transporter.verify(function(error, success) {
if (error) {
return;
} else {
var message = "A " + type + " change was requested on <b>" + channel + "</b><br><br>New supposed value is: <br><br><b>" + string + "</b><br><br><br> \
transporter.verify(function(error, success) {
if (error) {
return;
} else {
var message =
"A " +
type +
" change was requested on <b>" +
channel +
"</b><br><br>New supposed value is: <br><br><b>" +
string +
"</b><br><br><br> \
Go to <a href='https://admin.zoff.me/'>https://admin.zoff.me/</a> to accept or decline the request.";
var msg = {
from: mailconfig.from,
to: mailconfig.notify_mail,
subject: 'ZOFF: Requested new ' + type,
text: message,
html: message,
}
transporter.sendMail(msg, (error, info) => {
if (error) {
transporter.close();
return;
}
transporter.close();
});
}
var msg = {
from: mailconfig.from,
to: mailconfig.notify_mail,
subject: "ZOFF: Requested new " + type,
text: message,
html: message
};
transporter.sendMail(msg, (error, info) => {
if (error) {
transporter.close();
return;
}
transporter.close();
});
} catch(e) {
console.log("Mail is not configured and wont work");
console.log("Seems you forgot to create a mailconfig.js in /server/config/. Have a look at the mailconfig.example.js.");
}
}
});
} catch (e) {
console.log("Mail is not configured and wont work");
console.log(
"Seems you forgot to create a mailconfig.js in /server/config/. Have a look at the mailconfig.example.js."
);
}
}
module.exports.requested_change = requested_change;