convert habitica.com to BASE_URL

This commit is contained in:
Alys 2015-08-23 12:23:35 +10:00
parent a4627be3ea
commit fd446fc5e5
2 changed files with 4 additions and 7 deletions

View file

@ -246,10 +246,9 @@ api.resetPassword = function(req, res, next){
from: "Habitica <admin@habitica.com>",
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 <strong>" + user.auth.local.username + "</strong> has been reset to <strong>" + newPassword + "</strong><br /><br />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.<br /><br />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 <strong>" + user.auth.local.username + "</strong> has been reset to <strong>" + newPassword + "</strong><br /><br />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.<br /><br />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);

View file

@ -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();
};
};