Skip to content

Commit f4b1ecb

Browse files
Fix issue jaredhanson#180
1 parent 42db529 commit f4b1ecb

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

lib/strategy.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,17 @@ util.inherits(Strategy, passport.Strategy);
6868
*/
6969
Strategy.prototype.authenticate = function(req, options) {
7070
options = options || {};
71-
var username = lookup(req.body, this._usernameField) || lookup(req.query, this._usernameField);
72-
var password = lookup(req.body, this._passwordField) || lookup(req.query, this._passwordField);
71+
var username = lookup(req.body, this._usernameField)
72+
if(username === null) {
73+
lookup(req.query, this._usernameField);
74+
}
75+
76+
var password = lookup(req.body, this._passwordField)
77+
if(password === null) {
78+
password = lookup(req.query, this._passwordField);
79+
}
7380

74-
if (!username || !password) {
81+
if (username === null || password === null) {
7582
return this.fail({ message: options.badRequestMessage || 'Missing credentials' }, 400);
7683
}
7784

0 commit comments

Comments
 (0)