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:
parent
3675d24adf
commit
d8c7c0ed7d
@ -35,7 +35,7 @@ function authorize(options) {
|
|||||||
|
|
||||||
return function(data, accept){
|
return function(data, accept){
|
||||||
if (!data.headers.cookie) {
|
if (!data.headers.cookie) {
|
||||||
return accept('Session cookie required.', false);
|
return accept(null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
var parsedCookie = cookie.parse(data.headers.cookie);
|
var parsedCookie = cookie.parse(data.headers.cookie);
|
||||||
@ -48,7 +48,7 @@ function authorize(options) {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return accept('Error in session store.', false);
|
return accept('Error in session store.', false);
|
||||||
} else if (!session) {
|
} else if (!session) {
|
||||||
return accept('Session not found.', false);
|
return accept(null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !session[ auth.passport._key ] ){
|
if( !session[ auth.passport._key ] ){
|
||||||
@ -60,7 +60,7 @@ function authorize(options) {
|
|||||||
if( !userKey && auth.fail ) {
|
if( !userKey && auth.fail ) {
|
||||||
return auth.fail( data, accept );
|
return auth.fail( data, accept );
|
||||||
} else if( !userKey ) {
|
} else if( !userKey ) {
|
||||||
return accept('not yet authenticated', false);
|
return accept(null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( auth.success ) {
|
if( auth.success ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user