diff --git a/lib/strategy.js b/lib/strategy.js index 04172bb..879aa55 100644 --- a/lib/strategy.js +++ b/lib/strategy.js @@ -68,10 +68,17 @@ util.inherits(Strategy, passport.Strategy); */ Strategy.prototype.authenticate = function(req, options) { options = options || {}; - var username = lookup(req.body, this._usernameField) || lookup(req.query, this._usernameField); - var password = lookup(req.body, this._passwordField) || lookup(req.query, this._passwordField); + var username = lookup(req.body, this._usernameField) + if(username === null) { + lookup(req.query, this._usernameField); + } + + var password = lookup(req.body, this._passwordField) + if(password === null) { + password = lookup(req.query, this._passwordField); + } - if (!username || !password) { + if (username === null || password === null) { return this.fail({ message: options.badRequestMessage || 'Missing credentials' }, 400); } diff --git a/package.json b/package.json index f77ea9c..760fb16 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "passport-local", - "version": "1.0.0", + "version": "1.0.1", "description": "Local username and password authentication strategy for Passport.", "keywords": [ "passport",