feat(config): adds a generic DOMAIN configuration environment (#1469)

Generic DOMAI configuration environment variable, useful for setting links to an app
in reset email templates, and other cases.

Fixes #871 and #847
This commit is contained in:
Liran Tal
2016-09-01 22:37:43 +03:00
committed by GitHub
parent 54ae7dc564
commit cf246babd1
4 changed files with 19 additions and 1 deletions

View File

@@ -61,11 +61,14 @@ exports.forgot = function (req, res, next) {
if (config.secure && config.secure.ssl === true) {
httpTransport = 'https://';
}
var baseUrl = req.app.get('domain') || httpTransport + req.headers.host;
console.log(baseUrl);
res.render(path.resolve('modules/users/server/templates/reset-password-email'), {
name: user.displayName,
appName: config.app.title,
url: httpTransport + req.headers.host + '/api/auth/reset/' + token
url: baseUrl + '/api/auth/reset/' + token
}, function (err, emailHTML) {
console.log(emailHTML);
done(err, emailHTML, user);
});
},