registerEventListener(SuspiciousLoginEvent::class, LoginNotificationListener::class); $context->registerEventListener(SuspiciousLoginEvent::class, LoginMailListener::class); $context->registerEventListener(PostLoginEvent::class, LoginListener::class); $context->registerNotifierService(Notifier::class); } public function boot(IBootContext $context): void { $context->injectFn(function (IEventDispatcher $dispatcher) { $loginHookAdapter = new class($dispatcher) { /** @var IEventDispatcher */ private $dispatcher; public function __construct(IEventDispatcher $dispatcher) { $this->dispatcher = $dispatcher; } public function handle(array $data) { if (!isset($data['uid'], $data['isTokenLogin'])) { // Ignore invalid data return; } $this->dispatcher->dispatch( PostLoginEvent::class, new PostLoginEvent($data['uid'], $data['isTokenLogin']) ); } }; Util::connectHook( 'OC_User', 'post_login', $loginHookAdapter, 'handle' ); }); } }