diff --git a/lib/modules/password.js b/lib/modules/password.js index e64dc1ce..13807ce7 100644 --- a/lib/modules/password.js +++ b/lib/modules/password.js @@ -162,7 +162,7 @@ everyModule.submodule('password') .accepts('req res next') .promises('login password') .step('authenticate') - .accepts('login password') + .accepts('login password req') .promises('userOrErrors') .step('interpretUserOrErrors') .description('Pipes the output of the step `authenticate` into either the `user` or `errors` param') @@ -178,7 +178,7 @@ everyModule.submodule('password') .promises(null) .step('respondToLoginSucceed') // TODO Rename to maybeRespondToLoginSucceed ? .description('Execute a HTTP response for a successful login') - .accepts('res user') + .accepts('req res user') .promises(null) .step('respondToLoginFail') .description('Execute a HTTP response for a failed login') @@ -255,7 +255,7 @@ everyModule.submodule('password') .step('getSession') .step('addToSession') .step('respondToRegistrationSucceed') - .accepts('res user') + .accepts('req res user') .promises(null) .extractExtraRegistrationParams( function (req) { return {}; diff --git a/lib/utils.js b/lib/utils.js index 71e922d6..da14194b 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -1,5 +1,3 @@ -var tls = require('tls'); - var clone = exports.clone = function clone (obj) { if (obj === undefined || obj === null) return obj @@ -25,11 +23,5 @@ function cloneArray (arr) { }; exports.extractHostname = function (req) { - var headers = req.headers - , protocol = (req.connection.server instanceof tls.Server || - req.headers['x-forwarded-proto'].slice(0,5) == 'https') - ? 'https://' - : 'http://' - , host = headers.host; - return protocol + host; + return req.protocol + '://' + req.headers.host; };