From b2ffbf4113f3cca68402aca7cbbff2738585dbb1 Mon Sep 17 00:00:00 2001 From: Matteo Pagliazzi Date: Tue, 7 Apr 2015 15:53:26 +0200 Subject: [PATCH] password resets back to nodemailer... --- website/src/controllers/auth.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/website/src/controllers/auth.js b/website/src/controllers/auth.js index 0eed586c94..335b5baaa1 100644 --- a/website/src/controllers/auth.js +++ b/website/src/controllers/auth.js @@ -221,10 +221,13 @@ api.resetPassword = function(req, res, next){ if (!user) return res.send(401, {err:"Couldn't find a user registered for email " + email}); user.auth.local.salt = salt; user.auth.local.hashed_password = hashed_password; - utils.txnEmail(user, 'reset-password', [ - {name: "NEW_PASSWORD", content: newPassword}, - {name: "USERNAME", content: user.auth.local.username} - ]); + utils.sendEmail({ + from: "HabitRPG ", + to: email, + subject: "Password Reset for HabitRPG", + text: "Password for " + user.auth.local.username + " has been reset to " + newPassword + ". Log in at " + nconf.get('BASE_URL') + ". After you've logged in, head to "+nconf.get('BASE_URL')+"/#/options/settings/settings and change your password.", + html: "Password for " + user.auth.local.username + " has been reset to " + newPassword + ". Log in at " + nconf.get('BASE_URL') + ". After you've logged in, head to "+nconf.get('BASE_URL')+"/#/options/settings/settings and change your password." + }); user.save(function(err){ if(err) return next(err); res.send('New password sent to '+ email);