-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add email password reset support
- Loading branch information
Showing
18 changed files
with
571 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* jslint node: true */ | ||
'use strict'; | ||
|
||
// ENiGMA½ | ||
const Config = require('./config.js').config; | ||
const Errors = require('./enig_error.js').Errors; | ||
const Log = require('./logger.js').log; | ||
|
||
// deps | ||
const _ = require('lodash'); | ||
const nodeMailer = require('nodemailer'); | ||
|
||
exports.sendMail = sendMail; | ||
|
||
function sendMail(message, cb) { | ||
if(!_.has(Config, 'email.transport')) { | ||
return cb(Errors.MissingConfig('Email "email::transport" configuration missing')); | ||
} | ||
|
||
message.from = message.from || Config.email.defaultFrom; | ||
|
||
const transportOptions = Object.assign( {}, Config.email.transport, { | ||
logger : Log, | ||
}); | ||
|
||
const transport = nodeMailer.createTransport(transportOptions); | ||
|
||
transport.sendMail(message, (err, info) => { | ||
return cb(err, info); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.