Don't store SMTP password in variable (much security, wow)

This commit is contained in:
Nihanth Subramanya 2018-01-15 18:01:17 +05:30
Родитель 346f33ffb1
Коммит d353f10ec5
1 изменённых файлов: 3 добавлений и 4 удалений

Просмотреть файл

@ -11,7 +11,6 @@ app.use(express.static("public"));
var gEmails = new Set();
var kSMTPUsername;
var kSMTPPassword;
app.get("/", function(req, res) {
res.send("blurts-server v0.01a");
@ -70,15 +69,15 @@ if (process.env.DEBUG_DUMMY_SMTP) {
} else {
console.log("Attempting to get SMTP credentials from environment...");
kSMTPUsername = process.env.SMTP_USERNAME;
kSMTPPassword = process.env.SMTP_PASSWORD;
if (kSMTPUsername && kSMTPPassword) {
let password = process.env.SMTP_PASSWORD;
if (kSMTPUsername && password) {
gTransporter = nodemailer.createTransport({
host: "smtp.gmail.com",
port: 465,
secure: true,
auth: {
user: kSMTPUsername,
pass: kSMTPPassword,
pass: password,
},
});
}