This commit is contained in:
候学杰 2018-02-05 15:25:53 +08:00
parent c32291ca4d
commit dba07ef64b

View File

@ -63,6 +63,13 @@ class Authenticate
//登录状态检测 //登录状态检测
if ($this->auth->guard($guard)->guest()) { if ($this->auth->guard($guard)->guest()) {
if ($request->isXmlHttpRequest()) {
return response()->json([
'code' => 401,
'msg' => 'need login',
'data' => null,
]);
}
return redirect(app('pd.auth')->connect($request->getUri())); return redirect(app('pd.auth')->connect($request->getUri()));
} }
@ -81,7 +88,14 @@ class Authenticate
return $next($request); return $next($request);
} }
abort(403, '无权访问,请联系管理员授权'); if ($request->isXmlHttpRequest()) {
return response()->json([
'code' => 403,
'msg' => '无权访问,请联系管理员授权',
'data' => null,
]);
}
api_abort(403, '无权访问,请联系管理员授权');
return $next($request); return $next($request);
} }
} }