fix(twofactor_backupcodes): Mirate away from deprecated event

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
pull/43194/head
Côme Chilliet 4 months ago committed by Côme Chilliet
parent 8bcc2d352e
commit 94cd1b1912

@ -40,7 +40,8 @@ use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\Authentication\TwoFactorAuth\IRegistry;
use OCP\Authentication\TwoFactorAuth\TwoFactorProviderForUserRegistered;
use OCP\Authentication\TwoFactorAuth\TwoFactorProviderForUserUnregistered;
use OCP\User\Events\UserDeletedEvent;
class Application extends App implements IBootstrap {
@ -56,8 +57,8 @@ class Application extends App implements IBootstrap {
$context->registerEventListener(CodesGenerated::class, ActivityPublisher::class);
$context->registerEventListener(CodesGenerated::class, RegistryUpdater::class);
$context->registerEventListener(CodesGenerated::class, ClearNotifications::class);
$context->registerEventListener(IRegistry::EVENT_PROVIDER_ENABLED, ProviderEnabled::class);
$context->registerEventListener(IRegistry::EVENT_PROVIDER_DISABLED, ProviderDisabled::class);
$context->registerEventListener(TwoFactorProviderForUserRegistered::class, ProviderEnabled::class);
$context->registerEventListener(TwoFactorProviderForUserUnregistered::class, ProviderDisabled::class);
$context->registerEventListener(UserDeletedEvent::class, UserDeleted::class);

@ -28,12 +28,12 @@ namespace OCA\TwoFactorBackupCodes\Listener;
use OCA\TwoFactorBackupCodes\BackgroundJob\RememberBackupCodesJob;
use OCP\Authentication\TwoFactorAuth\IRegistry;
use OCP\Authentication\TwoFactorAuth\RegistryEvent;
use OCP\Authentication\TwoFactorAuth\TwoFactorProviderForUserUnregistered;
use OCP\BackgroundJob\IJobList;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
/** @template-implements IEventListener<RegistryEvent> */
/** @template-implements IEventListener<TwoFactorProviderForUserUnregistered> */
class ProviderDisabled implements IEventListener {
/** @var IRegistry */
@ -49,7 +49,7 @@ class ProviderDisabled implements IEventListener {
}
public function handle(Event $event): void {
if (!($event instanceof RegistryEvent)) {
if (!($event instanceof TwoFactorProviderForUserUnregistered)) {
return;
}

@ -28,12 +28,12 @@ namespace OCA\TwoFactorBackupCodes\Listener;
use OCA\TwoFactorBackupCodes\BackgroundJob\RememberBackupCodesJob;
use OCP\Authentication\TwoFactorAuth\IRegistry;
use OCP\Authentication\TwoFactorAuth\RegistryEvent;
use OCP\Authentication\TwoFactorAuth\TwoFactorProviderForUserRegistered;
use OCP\BackgroundJob\IJobList;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
/** @template-implements IEventListener<RegistryEvent> */
/** @template-implements IEventListener<TwoFactorProviderForUserRegistered> */
class ProviderEnabled implements IEventListener {
/** @var IRegistry */
@ -49,7 +49,7 @@ class ProviderEnabled implements IEventListener {
}
public function handle(Event $event): void {
if (!($event instanceof RegistryEvent)) {
if (!($event instanceof TwoFactorProviderForUserRegistered)) {
return;
}

Loading…
Cancel
Save