mirror of
https://github.com/flarum/framework.git
synced 2024-11-24 17:12:13 +08:00
Dispatch user events after password reset
Previously PasswordChanged was never sent
This commit is contained in:
parent
26e53fc51b
commit
f3e29ab801
|
@ -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');
|
||||
|
|
Loading…
Reference in New Issue
Block a user