diff options
| author | Jules Laplace <jules@okfoc.us> | 2014-08-25 13:12:27 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2014-08-25 13:40:12 -0400 |
| commit | 099dfd16940c62e931bf01e7f62b7a45f2b8c654 (patch) | |
| tree | b10d4dc452d01783619966a43ea10decc75e4344 /server/lib/auth/mail.js | |
| parent | 4ef340497ef24bb2ecacb2c9c4106c24515c874f (diff) | |
collaborators api
Diffstat (limited to 'server/lib/auth/mail.js')
| -rw-r--r-- | server/lib/auth/mail.js | 24 |
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 |
