Allow 0 value for serialized user (id)
This commit is contained in:
parent
c5d4489d68
commit
efef45309f
11
lib/index.js
11
lib/index.js
@ -26,7 +26,7 @@ function authorize(options) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var auth = xtend({}, defaults, options );
|
var auth = xtend({}, defaults, options );
|
||||||
|
|
||||||
auth.userProperty = auth.passport._userProperty || 'user';
|
auth.userProperty = auth.passport._userProperty || 'user';
|
||||||
|
|
||||||
if (typeof auth.cookieParser === 'undefined' || !auth.cookieParser) {
|
if (typeof auth.cookieParser === 'undefined' || !auth.cookieParser) {
|
||||||
@ -55,10 +55,11 @@ function authorize(options) {
|
|||||||
|
|
||||||
var userKey = session[ auth.passport._key ][ auth.userProperty ];
|
var userKey = session[ auth.passport._key ][ auth.userProperty ];
|
||||||
|
|
||||||
if( !userKey && auth.fail ) {
|
if(userKey === undefined)
|
||||||
return auth.fail( data, accept );
|
if(auth.fail)
|
||||||
} else if( !userKey ) {
|
return auth.fail( data, accept );
|
||||||
return accept(null, false);
|
else
|
||||||
|
return accept(null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
auth.passport.deserializeUser(userKey, function(err, user) {
|
auth.passport.deserializeUser(userKey, function(err, user) {
|
||||||
|
Reference in New Issue
Block a user