diff --git a/apps/files_external/lib/AppInfo/Application.php b/apps/files_external/lib/AppInfo/Application.php index a6c2aff947b67..1ad1a2ed779c7 100644 --- a/apps/files_external/lib/AppInfo/Application.php +++ b/apps/files_external/lib/AppInfo/Application.php @@ -42,6 +42,7 @@ use OCA\Files_External\Lib\Config\IBackendProvider; use OCA\Files_External\Listener\GroupDeletedListener; use OCA\Files_External\Listener\LoadAdditionalListener; +use OCA\Files_External\Listener\StorePasswordListener; use OCA\Files_External\Listener\UserDeletedListener; use OCA\Files_External\Service\BackendService; use OCP\AppFramework\App; @@ -51,7 +52,9 @@ use OCP\AppFramework\QueryException; use OCP\Files\Config\IMountProviderCollection; use OCP\Group\Events\GroupDeletedEvent; +use OCP\User\Events\PasswordUpdatedEvent; use OCP\User\Events\UserDeletedEvent; +use OCP\User\Events\UserLoggedInEvent; /** * @package OCA\Files_External\AppInfo @@ -72,6 +75,8 @@ public function register(IRegistrationContext $context): void { $context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class); $context->registerEventListener(GroupDeletedEvent::class, GroupDeletedListener::class); $context->registerEventListener(LoadAdditionalScriptsEvent::class, LoadAdditionalListener::class); + $context->registerEventListener(UserLoggedInEvent::class, StorePasswordListener::class); + $context->registerEventListener(PasswordUpdatedEvent::class, StorePasswordListener::class); $context->registerConfigLexicon(ConfigLexicon::class); } @@ -86,10 +91,6 @@ public function boot(IBootContext $context): void { return $userConfigHandler; }); }); - - // force-load auth mechanisms since some will register hooks - // TODO: obsolete these and use the TokenProvider to get the user's password from the session - $this->getAuthMechanisms(); } /** diff --git a/apps/files_external/lib/Lib/Auth/Password/LoginCredentials.php b/apps/files_external/lib/Lib/Auth/Password/LoginCredentials.php index ce38140b6eede..ec8498956983c 100644 --- a/apps/files_external/lib/Lib/Auth/Password/LoginCredentials.php +++ b/apps/files_external/lib/Lib/Auth/Password/LoginCredentials.php @@ -11,18 +11,14 @@ use OCA\Files_External\Lib\DefinitionParameter; use OCA\Files_External\Lib\InsufficientDataForMeaningfulAnswerException; use OCA\Files_External\Lib\StorageConfig; -use OCA\Files_External\Listener\StorePasswordListener; use OCP\Authentication\Exceptions\CredentialsUnavailableException; use OCP\Authentication\LoginCredentials\IStore as CredentialsStore; -use OCP\EventDispatcher\IEventDispatcher; use OCP\IL10N; use OCP\ISession; use OCP\IUser; use OCP\IUserBackend; use OCP\LDAP\ILDAPProviderFactory; use OCP\Security\ICredentialsManager; -use OCP\User\Events\PasswordUpdatedEvent; -use OCP\User\Events\UserLoggedInEvent; /** * Username and password from login credentials, saved in DB @@ -35,7 +31,6 @@ public function __construct( protected ISession $session, protected ICredentialsManager $credentialsManager, private CredentialsStore $credentialsStore, - IEventDispatcher $eventDispatcher, private ILDAPProviderFactory $ldapFactory, ) { $this @@ -48,9 +43,6 @@ public function __construct( ->setFlag(DefinitionParameter::FLAG_HIDDEN) ->setFlag(DefinitionParameter::FLAG_OPTIONAL), ]); - - $eventDispatcher->addServiceListener(UserLoggedInEvent::class, StorePasswordListener::class); - $eventDispatcher->addServiceListener(PasswordUpdatedEvent::class, StorePasswordListener::class); } private function getCredentials(IUser $user): array {