mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-03-12 07:00:29 +01:00
Abstract nodemailer createTransport
Currently createTransport is unnecessarily called upon every time a password request is made.
This commit is contained in:
@@ -12,6 +12,8 @@ var _ = require('lodash'),
|
||||
nodemailer = require('nodemailer'),
|
||||
async = require('async'),
|
||||
crypto = require('crypto');
|
||||
|
||||
var smtpTransport = nodemailer.createTransport(config.mailer.options);
|
||||
|
||||
/**
|
||||
* Forgot for reset password (forgot POST)
|
||||
@@ -65,7 +67,6 @@ exports.forgot = function(req, res, next) {
|
||||
},
|
||||
// If valid email, send reset email using service
|
||||
function(emailHTML, user, done) {
|
||||
var smtpTransport = nodemailer.createTransport(config.mailer.options);
|
||||
var mailOptions = {
|
||||
to: user.email,
|
||||
from: config.mailer.from,
|
||||
@@ -167,7 +168,6 @@ exports.reset = function(req, res, next) {
|
||||
},
|
||||
// If valid email, send reset email using service
|
||||
function(emailHTML, user, done) {
|
||||
var smtpTransport = nodemailer.createTransport(config.mailer.options);
|
||||
var mailOptions = {
|
||||
to: user.email,
|
||||
from: config.mailer.from,
|
||||
@@ -242,4 +242,4 @@ exports.changePassword = function(req, res) {
|
||||
message: 'User is not signed in'
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user