Correct gmail pw; fix undefined check if dead-man query returns 0 rows.
This commit is contained in:
parent
a277177fb5
commit
1a6f5d39c4
10
server.js
10
server.js
@ -14,7 +14,7 @@ var transporter = nodemailer.createTransport({
|
||||
service: 'Gmail',
|
||||
auth: {
|
||||
user: 'alertmonitorfl@gmail.com',
|
||||
pass: '6g*hkvVc%91oo3#$'
|
||||
pass: 'ZPW!KdxkdTSmyH99'
|
||||
}
|
||||
});
|
||||
var mailOptions = {
|
||||
@ -129,7 +129,7 @@ app.post('/', function(req, res){
|
||||
case "01": statusFromCode = "Open"; break;
|
||||
case "02": statusFromCode = "Closed"; break;
|
||||
case "03": statusFromCode = "GoodMorning"; break;
|
||||
case "04": statusFromCode = "GoodEvening";
|
||||
case "04": statusFromCode = "GoodEvening"; break;
|
||||
default: statusFromCode = "UnknownStatus"
|
||||
};
|
||||
var received_at = new Date(Date.now());
|
||||
@ -152,7 +152,7 @@ setInterval(function() {
|
||||
var deadManQry = "select published_at from Alerts where datetime(published_at) > datetime('now', '-14.5 hours') order by datetime(published_at) limit 1";
|
||||
db.get(deadManQry, function(err, row){
|
||||
if (err !== null) { winston.error(err); }
|
||||
else if (typeof row == undefined) {
|
||||
else if (typeof row == "undefined") {
|
||||
mailOptions.text = "It's been too long since the last data transmission from device. \n\n";
|
||||
winston.info(mailOptions.text);
|
||||
// Don't include any other details for now, will need to change DB query to get details on last message received.
|
||||
@ -160,9 +160,9 @@ setInterval(function() {
|
||||
//mailOptions.text = mailOptions.text + 'Published at, ' + courtsopenUtils.getLocDateFromUTC(pubAt) + ' ' + courtsopenUtils.getLocTimeFromUTC(pubAt) + '\n';
|
||||
transporter.sendMail(mailOptions, function(error, info){
|
||||
if(error){
|
||||
console.log(error);
|
||||
winston.info(error);
|
||||
}else{
|
||||
console.log('Message sent: ' + info.response);
|
||||
winston.info('Message sent: ' + info.response);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user