diff --git a/website/src/controllers/auth.js b/website/src/controllers/auth.js index 440ee9fed6..023adb0eec 100644 --- a/website/src/controllers/auth.js +++ b/website/src/controllers/auth.js @@ -246,10 +246,9 @@ api.resetPassword = function(req, res, next){ from: "Habitica ", to: email, subject: "Password Reset for Habitica", - text: "Password for " + user.auth.local.username + " has been reset to " + newPassword + " Important! Both username and password are case-sensitive -- you must enter both exactly as shown here. We recommend copying and pasting both instead of typing them. Log in at https://habitica.com/. After you've logged in, head to https://habitica.com/#/options/settings/settings and change your password.", - html: "Password for " + user.auth.local.username + " has been reset to " + newPassword + "

Important! Both username and password are case-sensitive -- you must enter both exactly as shown here. We recommend copying and pasting both instead of typing them.

Log in at https://habitica.com/. After you've logged in, head to https://habitica.com/#/options/settings/settings and change your password." + text: "Password for " + user.auth.local.username + " has been reset to " + newPassword + " Important! Both username and password are case-sensitive -- you must enter both exactly as shown here. We recommend copying and pasting both instead of typing them. 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 + "

Important! Both username and password are case-sensitive -- you must enter both exactly as shown here. We recommend copying and pasting both instead of typing them.

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." }); - // TODO: change all four instances of habitica.com above to use BASE_URL when it has been updated. Previous version: https://github.com/HabitRPG/habitrpg/blob/2069936603aca7f8139a6c98e063136248262bdf/website/src/controllers/auth.js#L249 user.save(function(err){ if(err) return next(err); res.send('New password sent to '+ email); diff --git a/website/src/middlewares/redirects.js b/website/src/middlewares/redirects.js index 25b8d44fa9..cb2fb7fc50 100644 --- a/website/src/middlewares/redirects.js +++ b/website/src/middlewares/redirects.js @@ -28,8 +28,6 @@ module.exports.forceSSL = function(req, res, next){ }; // Redirect to habitica for non-api urls -// NOTE: Currently using a static 'habitica.com' string, rather than BASE_URL, -// to make rollback easy. Eventually, BASE_URL should be migrated. function nonApiUrl(req) { return req.url.search(/\/api\//) === -1; @@ -37,7 +35,7 @@ function nonApiUrl(req) { module.exports.forceHabitica = function(req, res, next) { if (IS_PROD && !ignoreRedirect && !isProxied(req) && nonApiUrl(req)) { - return res.redirect('https://habitica.com' + req.url); + return res.redirect(BASE_URL + req.url); } next(); -}; \ No newline at end of file +};