1
0
mirror of https://github.com/flarum/core.git synced 2025-10-23 04:36:08 +02:00

Move some API error handling code around. It still sucks though

This commit is contained in:
Toby Zerner
2015-05-07 16:08:20 +09:30
parent a5b2a3da03
commit b5169512cb
4 changed files with 22 additions and 27 deletions

View File

@@ -3,6 +3,7 @@
use Flarum\Api\Request;
use Flarum\Core\Commands\GenerateAccessTokenCommand;
use Flarum\Core\Repositories\UserRepositoryInterface;
use Flarum\Core\Exceptions\PermissionDeniedException;
use Illuminate\Http\JsonResponse;
use Illuminate\Contracts\Bus\Dispatcher;
@@ -32,9 +33,8 @@ class TokenAction implements ActionInterface
$user = $this->users->findByIdentification($identification);
if (! $user || ! $user->checkPassword($password)) {
return;
// throw an exception
// return $this->respondWithError('invalidCredentials', 401);
// throw new PermissionDeniedException;
return new JsonResponse(null, 401);
}
$token = $this->bus->dispatch(