From d3b947558e85bcdfa0cf66a2be521e7a0fd395df Mon Sep 17 00:00:00 2001 From: genuisereal Date: Thu, 13 Jun 2013 13:55:16 +0300 Subject: [PATCH] OpenID sendToAuthenticationUri lacks promise Openid module sendToAuthenticationUri step did not provide correct Promise object reference to use inside this.relyingParty.authenticate callback function. Also call back function did not fulfill promise(caused timeout error) and step itself did not return promise reference (caused uncaught exception). original pull request #379 which was merged and still this problem arises --- lib/modules/openid.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/modules/openid.js b/lib/modules/openid.js index 6f083fd8..e117c8ef 100644 --- a/lib/modules/openid.js +++ b/lib/modules/openid.js @@ -50,11 +50,16 @@ everyModule.submodule('openid') if (!this._myHostname || this._alwaysDetectHostname) { this.myHostname(extractHostname(req)); } + + var p = this.Promise(); - this.relyingParty.authenticate(req.query[this.openidURLField()], false, function(err,authenticationUrl){ + this.relyingParty.authenticate(req.query[this.openidURLField()], false, (function(err,authenticationUrl){ if(err) return p.fail(err); this.redirect(res, authenticationUrl); - }); + }).bind(this)); + + p.fulfill(); + return p; }) .getSession( function(req) { return req.session;