diff --git a/core/lib/Thelia/Action/Customer.php b/core/lib/Thelia/Action/Customer.php index 6220aefe5..30e6a573b 100644 --- a/core/lib/Thelia/Action/Customer.php +++ b/core/lib/Thelia/Action/Customer.php @@ -147,6 +147,11 @@ class Customer extends BaseAction implements EventSubscriberInterface public function login(CustomerLoginEvent $event) { + $customer = $event->getCustomer(); + + if (method_exists($customer, 'clearDispatcher')) { + $customer->clearDispatcher(); + } $this->securityContext->setCustomerUser($event->getCustomer()); } diff --git a/core/lib/Thelia/Model/Tools/ModelEventDispatcherTrait.php b/core/lib/Thelia/Model/Tools/ModelEventDispatcherTrait.php index 759d032d4..10aae9ab4 100644 --- a/core/lib/Thelia/Model/Tools/ModelEventDispatcherTrait.php +++ b/core/lib/Thelia/Model/Tools/ModelEventDispatcherTrait.php @@ -53,6 +53,11 @@ trait ModelEventDispatcherTrait return $this->dispatcher; } + public function clearDispatcher() + { + $this->dispatcher = null; + } + protected function dispatchEvent($eventName, ActionEvent $event) { if (!is_null($this->dispatcher)) {