Respond with the correct responses on error

This commit is contained in:
Graham Campbell
2015-06-17 14:06:18 +01:00
parent 0acc419bab
commit 8c4653c18c
16 changed files with 10 additions and 342 deletions
+2 -4
View File
@@ -13,7 +13,7 @@ namespace CachetHQ\Cachet\Http\Middleware;
use Closure;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Support\Facades\Response;
use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException;
class Admin
{
@@ -45,9 +45,7 @@ class Admin
public function handle($request, Closure $next)
{
if (!$this->auth->check() || ($this->auth->check() && !$this->auth->user()->isAdmin)) {
return Response::view('errors.401', [
'pageTitle' => trans('errors.unauthorized.title'),
], 401);
throw new UnauthorizedHttpException();
}
return $next($request);