X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/a6633642232efd164d4708967ab59e498fbff896..refs/pull/2877/head:/app/Http/Middleware/ApiAuthenticate.php diff --git a/app/Http/Middleware/ApiAuthenticate.php b/app/Http/Middleware/ApiAuthenticate.php index 728057bed..21d69810f 100644 --- a/app/Http/Middleware/ApiAuthenticate.php +++ b/app/Http/Middleware/ApiAuthenticate.php @@ -29,6 +29,7 @@ class ApiAuthenticate /** * Ensure the current user can access authenticated API routes, either via existing session * authentication or via API Token authentication. + * * @throws UnauthorizedException */ protected function ensureAuthorizedBySessionOrToken(): void @@ -40,6 +41,7 @@ class ApiAuthenticate if (!user()->can('access-api')) { throw new ApiAuthException(trans('errors.api_user_no_api_permission'), 403); } + return; } @@ -58,9 +60,9 @@ class ApiAuthenticate { return response()->json([ 'error' => [ - 'code' => $code, + 'code' => $code, 'message' => $message, - ] + ], ], $code); } }