diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-02-09 11:51:09 +0100 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-02-09 18:49:35 +0100 |
commit | f8808e260dacfd8214e405d493365f4ecaf4d953 (patch) | |
tree | 6eaffc3c6d52f8a1eac63646f6728eabcbc8032c /core/Controller/AppPasswordController.php | |
parent | 9eea1e56dc0c33c504fb0e98578e22115b6b4c79 (diff) | |
download | nextcloud-server-f8808e260dacfd8214e405d493365f4ecaf4d953.tar.gz nextcloud-server-f8808e260dacfd8214e405d493365f4ecaf4d953.zip |
Move app_password_created to a typed event
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'core/Controller/AppPasswordController.php')
-rw-r--r-- | core/Controller/AppPasswordController.php | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/core/Controller/AppPasswordController.php b/core/Controller/AppPasswordController.php index 2f8c1184def..15f86b4ad6a 100644 --- a/core/Controller/AppPasswordController.php +++ b/core/Controller/AppPasswordController.php @@ -27,6 +27,7 @@ declare(strict_types=1); namespace OC\Core\Controller; +use OC\Authentication\Events\AppPasswordCreatedEvent; use OC\Authentication\Exceptions\InvalidTokenException; use OC\Authentication\Token\IProvider; use OC\Authentication\Token\IToken; @@ -35,11 +36,10 @@ use OCP\AppFramework\OCS\OCSForbiddenException; use OCP\Authentication\Exceptions\CredentialsUnavailableException; use OCP\Authentication\Exceptions\PasswordUnavailableException; use OCP\Authentication\LoginCredentials\IStore; +use OCP\EventDispatcher\IEventDispatcher; use OCP\IRequest; use OCP\ISession; use OCP\Security\ISecureRandom; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; class AppPasswordController extends \OCP\AppFramework\OCSController { @@ -55,7 +55,7 @@ class AppPasswordController extends \OCP\AppFramework\OCSController { /** @var IStore */ private $credentialStore; - /** @var EventDispatcherInterface */ + /** @var IEventDispatcher */ private $eventDispatcher; public function __construct(string $appName, @@ -64,7 +64,7 @@ class AppPasswordController extends \OCP\AppFramework\OCSController { ISecureRandom $random, IProvider $tokenProvider, IStore $credentialStore, - EventDispatcherInterface $eventDispatcher) { + IEventDispatcher $eventDispatcher) { parent::__construct($appName, $request); $this->session = $session; @@ -112,8 +112,9 @@ class AppPasswordController extends \OCP\AppFramework\OCSController { IToken::DO_NOT_REMEMBER ); - $event = new GenericEvent($generatedToken); - $this->eventDispatcher->dispatch('app_password_created', $event); + $this->eventDispatcher->dispatchTyped( + new AppPasswordCreatedEvent($generatedToken) + ); return new DataResponse([ 'apppassword' => $token |