mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-05 12:02:13 +00:00
password resets back to nodemailer...
This commit is contained in:
parent
16e67ab7d4
commit
b2ffbf4113
1 changed files with 7 additions and 4 deletions
|
|
@ -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});
|
if (!user) return res.send(401, {err:"Couldn't find a user registered for email " + email});
|
||||||
user.auth.local.salt = salt;
|
user.auth.local.salt = salt;
|
||||||
user.auth.local.hashed_password = hashed_password;
|
user.auth.local.hashed_password = hashed_password;
|
||||||
utils.txnEmail(user, 'reset-password', [
|
utils.sendEmail({
|
||||||
{name: "NEW_PASSWORD", content: newPassword},
|
from: "HabitRPG <admin@habitrpg.com>",
|
||||||
{name: "USERNAME", content: user.auth.local.username}
|
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 <strong>" + user.auth.local.username + "</strong> has been reset to <strong>" + newPassword + "</strong>. 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){
|
user.save(function(err){
|
||||||
if(err) return next(err);
|
if(err) return next(err);
|
||||||
res.send('New password sent to '+ email);
|
res.send('New password sent to '+ email);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue