mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-15 13:32:41 +08:00
fix user without authority can view approval page
This commit is contained in:
@@ -41,14 +41,19 @@ class Handler extends ExceptionHandler
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->reportable(function (InsufficientPermissionException $e) {
|
||||
if (request()->expectsJson()) {
|
||||
return response()->json(fail($e->getMessage(), request()->all()), 403);
|
||||
} else {
|
||||
return abort(403);
|
||||
}
|
||||
});
|
||||
|
||||
//Other Only handle in json request
|
||||
if (!request()->expectsJson()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->reportable(function (Throwable $e) {
|
||||
//
|
||||
});
|
||||
|
||||
$this->renderable(function (AuthenticationException $e) {
|
||||
return response()->json(fail($e->getMessage(), $e->guards()), 401);
|
||||
});
|
||||
@@ -82,7 +87,7 @@ class Handler extends ExceptionHandler
|
||||
{
|
||||
$data = $request->all();
|
||||
$httpStatusCode = $this->getHttpStatusCode($e);
|
||||
$msg = $e->getMessage();
|
||||
$msg = $e->getMessage() ?: class_basename($e);
|
||||
$trace = $e->getTraceAsString();
|
||||
if (config('app.debug')) {
|
||||
$data['trace'] = $trace;
|
||||
|
||||
Reference in New Issue
Block a user