From ebf17b72ffc7fad8531d65de4b8767e4f730fea9 Mon Sep 17 00:00:00 2001 From: Alexander Skvortsov <38059171+askvortsov1@users.noreply.github.com> Date: Wed, 17 Jun 2020 20:43:04 -0400 Subject: [PATCH] Return the proper error code when wrong password when changing email (#2171) --- framework/core/src/Api/Controller/UpdateUserController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/core/src/Api/Controller/UpdateUserController.php b/framework/core/src/Api/Controller/UpdateUserController.php index ae41f182b..6090e6fca 100644 --- a/framework/core/src/Api/Controller/UpdateUserController.php +++ b/framework/core/src/Api/Controller/UpdateUserController.php @@ -12,7 +12,7 @@ namespace Flarum\Api\Controller; use Flarum\Api\Serializer\CurrentUserSerializer; use Flarum\Api\Serializer\UserSerializer; use Flarum\User\Command\EditUser; -use Flarum\User\Exception\PermissionDeniedException; +use Flarum\User\Exception\NotAuthenticatedException; use Illuminate\Contracts\Bus\Dispatcher; use Illuminate\Support\Arr; use Psr\Http\Message\ServerRequestInterface; @@ -62,7 +62,7 @@ class UpdateUserController extends AbstractShowController $password = Arr::get($request->getParsedBody(), 'meta.password'); if (! $actor->checkPassword($password)) { - throw new PermissionDeniedException; + throw new NotAuthenticatedException; } }