Merge pull request #3635 from JacobBennett/patch-1
[5.2] Don't return a login page to a JSON request
This commit is contained in:
commit
c6931d266a
|
@ -18,7 +18,7 @@ class Authenticate
|
|||
public function handle($request, Closure $next, $guard = null)
|
||||
{
|
||||
if (Auth::guard($guard)->guest()) {
|
||||
if ($request->ajax()) {
|
||||
if ($request->ajax() || $request->wantsJson()) {
|
||||
return response('Unauthorized.', 401);
|
||||
} else {
|
||||
return redirect()->guest('login');
|
||||
|
|
Loading…
Reference in New Issue