Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
Abstract nodemailer createTransport
Browse files Browse the repository at this point in the history
Currently createTransport is unnecessarily called upon every time a password request is made.
  • Loading branch information
mindmelting committed Nov 10, 2014
1 parent ad87029 commit d5cf18a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/controllers/users/users.password.server.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -242,4 +242,4 @@ exports.changePassword = function(req, res) {
message: 'User is not signed in'
});
}
};
};

0 comments on commit d5cf18a

Please sign in to comment.