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

Don't pass error message on failed accepts due to not being logged in, or the client gets 500s when they should get 403s

This commit is contained in:
Kevin Caffrey 2012-11-16 03:58:33 -05:00
parent 3675d24adf
commit d8c7c0ed7d

View File

@ -35,7 +35,7 @@ function authorize(options) {
return function(data, accept){
if (!data.headers.cookie) {
return accept('Session cookie required.', false);
return accept(null, false);
}
var parsedCookie = cookie.parse(data.headers.cookie);
@ -48,7 +48,7 @@ function authorize(options) {
if (err) {
return accept('Error in session store.', false);
} else if (!session) {
return accept('Session not found.', false);
return accept(null, false);
}
if( !session[ auth.passport._key ] ){
@ -56,11 +56,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('not yet authenticated', false);
return accept(null, false);
}
if( auth.success ) {