summaryrefslogtreecommitdiff
path: root/server/lib/auth/mail.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-08-25 13:12:27 -0400
committerJules Laplace <jules@okfoc.us>2014-08-25 13:40:12 -0400
commit099dfd16940c62e931bf01e7f62b7a45f2b8c654 (patch)
treeb10d4dc452d01783619966a43ea10decc75e4344 /server/lib/auth/mail.js
parent4ef340497ef24bb2ecacb2c9c4106c24515c874f (diff)
collaborators api
Diffstat (limited to 'server/lib/auth/mail.js')
-rw-r--r--server/lib/auth/mail.js24
1 files changed, 23 insertions, 1 deletions
diff --git a/server/lib/auth/mail.js b/server/lib/auth/mail.js
index a4abccd..0211325 100644
--- a/server/lib/auth/mail.js
+++ b/server/lib/auth/mail.js
@@ -10,7 +10,7 @@ var mail = {
templates: {},
init: function(){
- var names = ["welcome","password"].forEach(function(name){
+ var names = ["welcome","password","collaborator"].forEach(function(name){
mail.templates[name] = {};
var types = ["text","html"].forEach(function(type){
fs.readFile("views/mail/" + name + "." + type + ".ejs", function(err, data){
@@ -62,6 +62,28 @@ var mail = {
mail.send(message, cb)
console.log("sent password email to", user.email)
},
+
+ collaborator: function(project, user, collaborator, cb){
+ var data = {
+ projectSlug: project.slug,
+ projectName: project.name,
+ nonce: collaborator.nonce,
+ username: user.username,
+ }
+
+ var message = {
+ text: mail.templates.collaborator.text(data),
+ from: mail.from,
+ to: collaborator.email,
+ subject: "Join " + data.username + " on " + data.projectName,
+ attachment: [
+ { data: mail.templates.collaborator.html(data), alternative: true },
+ ]
+ }
+ mail.send(message, cb)
+ console.log("sent collaborator email to", user.email)
+ },
+
}
module.exports = mail