Skip to content

Commit

Permalink
Merge pull request #555 from navalkishore30/3.0
Browse files Browse the repository at this point in the history
In case of accepts json then instead of redirecting sending unauthorised response
  • Loading branch information
nWidart authored Jul 9, 2018
2 parents 53e8692 + a13deea commit 6d1bdc2
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 6d1bdc2

Please sign in to comment.