Skip to content

Commit

Permalink
In case of accepts json then instead of redirecting sending unauthori…
Browse files Browse the repository at this point in the history
…sed response
  • Loading branch information
naval-mantra committed Jul 3, 2018
1 parent e22a39d commit a13deea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Modules/Core/Http/Middleware/Authorization.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function handle($request, \Closure $next, $permission)
*/
private function handleUnauthorizedRequest(Request $request, $permission)
{
if ($request->ajax()) {
if ($request->ajax() || $request->wantsJson()) {
return response('Unauthorized.', Response::HTTP_FORBIDDEN);
}
if ($request->user() === null) {
Expand Down

0 comments on commit a13deea

Please sign in to comment.