From b824ebce977dbc5d44f23cfa949011d4c41d62b4 Mon Sep 17 00:00:00 2001 From: Liran Tal Date: Sat, 19 Sep 2015 11:00:47 +0300 Subject: [PATCH] fixed bug #923 - making password reset links work for both http and https configuration --- .../controllers/users/users.password.server.controller.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/users/server/controllers/users/users.password.server.controller.js b/modules/users/server/controllers/users/users.password.server.controller.js index aa51169403..fe83bec2aa 100644 --- a/modules/users/server/controllers/users/users.password.server.controller.js +++ b/modules/users/server/controllers/users/users.password.server.controller.js @@ -56,10 +56,15 @@ exports.forgot = function (req, res, next) { } }, function (token, user, done) { + + var httpTransport = 'http://'; + if (config.secure && config.secure.ssl === true) { + httpTransport = 'https://'; + } res.render(path.resolve('modules/users/server/templates/reset-password-email'), { name: user.displayName, appName: config.app.title, - url: 'http://' + req.headers.host + '/api/auth/reset/' + token + url: httpTransport + req.headers.host + '/api/auth/reset/' + token }, function (err, emailHTML) { done(err, emailHTML, user); });