Permalink
Browse files

Email notifications (#83)

Send email notifications when a candidate, candidate assistant, or AMA question is added to the site
  • Loading branch information...
draab authored and kochman committed Sep 5, 2017
1 parent 4c1d716 commit 99c79442c3c64d0a99f77bfefb88c8fbce45bbe7
Showing with 2,378 additions and 13 deletions.
  1. +9 −1 config.js
  2. +10 −1 devconfig.example.js
  3. +14 −3 functions.js
  4. +2,276 −0 package-lock.json
  5. +2 −1 package.json
  6. +22 −2 routes/ama.js
  7. +20 −2 routes/assistants.js
  8. +25 −3 routes/candidates.js
View
@@ -14,6 +14,14 @@ try {
cms: process.env.CMS_API_TOKEN,
service_url: process.env.SERVICE_URL,
cas_dev_mode: false,
cas_dev_mode_user: ''
cas_dev_mode_user: '',
email: {
username: process.env.EMAIL_USER,
password: process.env.EMAIL_PASSWORD,
from: process.env.EMAIL_FROM,
host: process.env.EMAIL_HOST,
secure: true,
port: 465
}
};
}
View
@@ -11,6 +11,7 @@
* https://cms.union.rpi.edu or contact the Rensselaer Union Systems Administrators.
* - service_url: the url (and port, if not 80) that the user is accessing your app from; used by the RPI Central
* Authentication System
* - email: settings required to connect to an SMTP relay
*/
module.exports = {
@@ -23,5 +24,13 @@ module.exports = {
cms: '',
service_url: 'http://localhost:3000',
cas_dev_mode: false,
cas_dev_mode_user: ''
cas_dev_mode_user: '',
email: {
username: '',
password: '',
from: 'RPI Elections <rne@rpi.edu>',
host: '',
secure: true,
port: 465
}
};
View
@@ -1,7 +1,9 @@
var db = require('./config.js').db,
mysql = require('mysql'),
cms = require('./cms.js'),
db_name = mysql.escapeId(require('./config.js').db_name);
db_name = mysql.escapeId(require('./config.js').db_name),
email = require('./config.js').email,
nodemailer = require('nodemailer');
module.exports = {
dbConnect: function (res) {
@@ -75,5 +77,14 @@ module.exports = {
determineCMSPromise: function(rcs_id) {
console.log(rcs_id);
return isNaN(parseInt(rcs_id)) ? cms.getRCS(rcs_id) : cms.getRIN(rcs_id);
}
};
},
mailer: nodemailer.createTransport({
host: email.host,
port: email.port,
secure: email.secure,
auth: {
user: email.username,
pass: email.password
}
})
};
Oops, something went wrong.

0 comments on commit 99c7944

Please sign in to comment.