Skip to content

Commit

Permalink
trying to sendgrid
Browse files Browse the repository at this point in the history
  • Loading branch information
wayne-o committed May 29, 2015
1 parent 4769ae4 commit 6125bc5
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 23 deletions.
Binary file added .DS_Store
Binary file not shown.
11 changes: 6 additions & 5 deletions lib/waterlock-local-auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,14 @@ exports.config = wlconfig;
*/
exports.authConfig = method;

if(typeof method === 'object' &&
if(typeof method === 'object' &&
typeof method.passwordReset !== 'undefined' &&
method.passwordReset.tokens){
var nodemailer = require('nodemailer');
var mail = method.passwordReset.mail;
var smtpTransport = nodemailer.createTransport(mail.protocol, mail.options);
exports.transport = smtpTransport;
var sgTransport = require('nodemailer-sendgrid-transport');
var mail = method.passwordReset.sgOptions;
var transport = nodemailer.createTransport(sgTransport(mail));
exports.transport = transport;
}

/**
Expand All @@ -57,4 +58,4 @@ exports.actions = require('./controllers');
* [model description]
* @type {[type]}
*/
exports.model = require('./models');
exports.model = require('./models');
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,23 @@
"authentication",
"sails"
],
"devDependencies":{
"devDependencies": {
"mocha": "*",
"should": "*",
"proxyquire": "*",
"coveralls": "*",
"istanbul": "*",
"jshint": "*"
},
"dependencies":{
"dependencies": {
"bcrypt": "~0.8.1",
"lodash": "~2.4.1",
"moment": "~2.9.0",
"nodemailer": "~1.3.0",
"jade": "~1.3.1",
"jwt-simple": "~0.2.0",
"node-uuid": "~1.4.2"
"lodash": "~2.4.1",
"moment": "~2.9.0",
"node-uuid": "~1.4.2",
"nodemailer": "^1.3.4",
"nodemailer-sendgrid-transport": "^0.1.0"
},
"author": "David Rivera <david.r.rivera193@gmail.com>",
"contributors": [
Expand Down
23 changes: 11 additions & 12 deletions test/waterlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
*
* defines various options used by waterlock
* for more informaiton checkout
*
*
* http://waterlock.ninja/documentation
*/
module.exports.waterlock = {

// Base URL
//
//
// used by auth methods for callback URI's using oauth and for password
// reset links.
baseUrl: "http://localhost:1337",
// Auth Method(s)
//
// this can be a single string, an object, or an array of objects for your

// Auth Method(s)
//
// this can be a single string, an object, or an array of objects for your
// chosen auth method(s) you will need to see the individual module's README
// file for more information on the attributes necessary. This is an example
// of the local authentication method with password reset tokens disabled.
Expand All @@ -27,7 +27,6 @@ module.exports.waterlock = {
passwordReset:{
tokens: false,
mail: {
protocol: "SMTP",
options:{
service: "Gmail",
auth: {
Expand All @@ -38,7 +37,7 @@ module.exports.waterlock = {
from: "no-reply@domain.com",
subject: "Your password reset!",
forwardUrl: "http://localhost:1337"
},
},
template:{
file: "../views/email.jade",
vars:{}
Expand All @@ -49,8 +48,8 @@ module.exports.waterlock = {

// JSON Web Tokens
//
// this provides waterlock with basic information to build your tokens,
// these tokens are used for authentication, password reset,
// this provides waterlock with basic information to build your tokens,
// these tokens are used for authentication, password reset,
// and anything else you can imagine
jsonWebTokens:{

Expand All @@ -63,4 +62,4 @@ module.exports.waterlock = {
audience: "app name",
subject: "subject"
}
}
}

1 comment on commit 6125bc5

@listepo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why nodemailer-sendgrid-transport? I and others are not using it. Add this feature as option

Please sign in to comment.