2
1
mirror of https://github.com/Thream/socketio-jwt.git synced 2024-07-21 09:38:31 +02:00

Allow 0 value for serialized user (id)

This commit is contained in:
Richard Assar 2013-06-30 20:06:21 +01:00
parent c5d4489d68
commit efef45309f

View File

@ -26,7 +26,7 @@ function authorize(options) {
};
var auth = xtend({}, defaults, options );
auth.userProperty = auth.passport._userProperty || 'user';
if (typeof auth.cookieParser === 'undefined' || !auth.cookieParser) {
@ -55,10 +55,11 @@ function authorize(options) {
var userKey = session[ auth.passport._key ][ auth.userProperty ];
if( !userKey && auth.fail ) {
return auth.fail( data, accept );
} else if( !userKey ) {
return accept(null, false);
if(userKey === undefined)
if(auth.fail)
return auth.fail( data, accept );
else
return accept(null, false);
}
auth.passport.deserializeUser(userKey, function(err, user) {