attempt to add new user mailer
This commit is contained in:
@ -22,6 +22,23 @@ passport.deserializeUser(function(id, done) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function sendWelcomeEmail(user) {
|
||||||
|
var transporter = nodemailer.createTransport({
|
||||||
|
service: 'Mandrill',
|
||||||
|
auth: {
|
||||||
|
user: secrets.mandrill.user,
|
||||||
|
pass: secrets.mandrill.password
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var mailOptions = {
|
||||||
|
to: user.email,
|
||||||
|
from: 'Team@freecodecamp.com',
|
||||||
|
subject: 'Welcome to Free Code Camp ' + user.name + '!',
|
||||||
|
text: 'Hello,\n\n' +
|
||||||
|
'Welcome to Free Code Camp!'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OAuth Strategy Overview
|
* OAuth Strategy Overview
|
||||||
*
|
*
|
||||||
@ -265,6 +282,9 @@ passport.use(new GoogleStrategy(secrets.google, function(req, accessToken, refre
|
|||||||
user.save(function(err) {
|
user.save(function(err) {
|
||||||
done(err, user);
|
done(err, user);
|
||||||
});
|
});
|
||||||
|
if (!existingEmailUser) {
|
||||||
|
sendWelcomeEmail(user);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ exports.logout = function(req, res) {
|
|||||||
exports.getEmailSignin = function(req, res) {
|
exports.getEmailSignin = function(req, res) {
|
||||||
if (req.user) return res.redirect('/');
|
if (req.user) return res.redirect('/');
|
||||||
res.render('account/email-signup', {
|
res.render('account/email-signup', {
|
||||||
title: 'Create Your Free Code Camp Account'
|
title: 'Sign in to your Free Code Camp Account'
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user