mirror of
https://github.com/flarum/framework.git
synced 2025-06-03 22:43:10 +08:00
Send a HTTP 401 for incorrect login credentials
This fixes a regression from #1843 and #1854. Now, the frontend again shows the proper "Incorrect login details" message instead of "You do not have permission to do that".
This commit is contained in:

committed by
Daniël Klabbers

parent
e80f5429d0
commit
1e55361539
@ -10,7 +10,7 @@
|
||||
namespace Flarum\Api\Controller;
|
||||
|
||||
use Flarum\Http\AccessToken;
|
||||
use Flarum\User\Exception\PermissionDeniedException;
|
||||
use Flarum\User\Exception\NotAuthenticatedException;
|
||||
use Flarum\User\UserRepository;
|
||||
use Illuminate\Contracts\Bus\Dispatcher as BusDispatcher;
|
||||
use Illuminate\Contracts\Events\Dispatcher as EventDispatcher;
|
||||
@ -63,7 +63,7 @@ class CreateTokenController implements RequestHandlerInterface
|
||||
$user = $this->users->findByIdentification($identification);
|
||||
|
||||
if (! $user || ! $user->checkPassword($password)) {
|
||||
throw new PermissionDeniedException;
|
||||
throw new NotAuthenticatedException;
|
||||
}
|
||||
|
||||
$token = AccessToken::generate($user->id, $lifetime);
|
||||
|
Reference in New Issue
Block a user