fix(email): allow sender email var for development

Allows setting the SES_ID, SES_SECRET and EMAIL_SENDER values
This commit is contained in:
Mrugesh Mohapatra
2017-04-23 14:18:33 +05:30
committed by Berkeley Martinez
parent 0ce30409c0
commit a426ff7ef9

View File

@ -597,20 +597,23 @@ module.exports = function(User) {
const mailOptions = { const mailOptions = {
type: 'email', type: 'email',
to: user.email, to: user.email,
<<<<<<< HEAD
from: 'Team@freecodecamp.com', from: 'Team@freecodecamp.com',
subject: 'Free Code Camp - Authentication Request!', subject: 'Free Code Camp - Authentication Request!',
=======
from: isDev ?
process.env.EMAIL_SENDER : 'team@freecodecamp.com',
subject: 'freeCodeCamp - Authentication Request!',
>>>>>>> fix(email): allow sender email var for development
text: renderAuthEmail({ text: renderAuthEmail({
loginEmail, loginEmail,
loginToken loginToken
}) })
}; };
if (!isDev) {
this.email.send(mailOptions, err =>{ this.email.send(mailOptions, err =>{
if (err) { throw err; } if (err) { throw err; }
}); });
} else {
console.log('~~~~\n' + mailOptions.text + '~~~~\n');
}
const emailAuthLinkTTL = token.created; const emailAuthLinkTTL = token.created;
this.update$({ this.update$({
emailAuthLinkTTL emailAuthLinkTTL