<?php
namespace App\Domain\Password\Subscriber;
use App\Domain\Auth\Event\BadPasswordLoginEvent;
use App\Domain\Auth\Event\UserCreatedEvent;
use App\Domain\Auth\Service\LoginAttemptService;
use App\Domain\Auth\Service\UserRegisterService;
use App\Domain\Password\Service\PasswordService;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class UserCreatedEventSubscriber implements EventSubscriberInterface
{
private PasswordService $service;
public function __construct(PasswordService $service)
{
$this->service = $service;
}
public static function getSubscribedEvents(): array
{
return [
UserCreatedEvent::class => 'onCreated',
];
}
public function onCreated(UserCreatedEvent $event): void
{
$this->service->updatePassword($event->getUser());
}
}