Commit a13deea2 authored by Naval Kishore's avatar Naval Kishore

In case of accepts json then instead of redirecting sending unauthorised response

parent e22a39da
......@@ -49,7 +49,7 @@ class Authorization
*/
private function handleUnauthorizedRequest(Request $request, $permission)
{
if ($request->ajax()) {
if ($request->ajax() || $request->wantsJson()) {
return response('Unauthorized.', Response::HTTP_FORBIDDEN);
}
if ($request->user() === null) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment