diff --git a/framework/core/src/Forum/Controller/SavePasswordController.php b/framework/core/src/Forum/Controller/SavePasswordController.php index ea3257062..8a49831d7 100644 --- a/framework/core/src/Forum/Controller/SavePasswordController.php +++ b/framework/core/src/Forum/Controller/SavePasswordController.php @@ -11,11 +11,13 @@ namespace Flarum\Forum\Controller; +use Flarum\Foundation\DispatchEventsTrait; use Flarum\Http\Controller\ControllerInterface; use Flarum\Http\SessionAuthenticator; use Flarum\Http\UrlGenerator; use Flarum\User\PasswordToken; use Flarum\User\UserValidator; +use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Contracts\Validation\Factory; use Illuminate\Validation\ValidationException; use Psr\Http\Message\ServerRequestInterface as Request; @@ -23,6 +25,8 @@ use Zend\Diactoros\Response\RedirectResponse; class SavePasswordController implements ControllerInterface { + use DispatchEventsTrait; + /** * @var UrlGenerator */ @@ -49,12 +53,13 @@ class SavePasswordController implements ControllerInterface * @param UserValidator $validator * @param Factory $validatorFactory */ - public function __construct(UrlGenerator $url, SessionAuthenticator $authenticator, UserValidator $validator, Factory $validatorFactory) + public function __construct(UrlGenerator $url, SessionAuthenticator $authenticator, UserValidator $validator, Factory $validatorFactory, Dispatcher $events) { $this->url = $url; $this->authenticator = $authenticator; $this->validator = $validator; $this->validatorFactory = $validatorFactory; + $this->events = $events; } /** @@ -88,6 +93,8 @@ class SavePasswordController implements ControllerInterface $token->user->changePassword($password); $token->user->save(); + $this->dispatchEventsFor($token->user); + $token->delete(); $session = $request->getAttribute('session');