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:
		| @@ -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 ) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user