I have an observer that is triggered when a user creates an account. In the execute
method I have the following code:
public function execute(\Magento\Framework\Event\Observer $observer)
{
$redirectionUrl = $this->url->getUrl('subscribe');
$this->responseFactory->create()->setRedirect($redirectionUrl)->sendResponse();
exit;
}
It does infact redirect as expected, but the user is not logged in after registration.
How can I redirect without having to use exit
? If I remove exit
the redirect doesn't happen.
exit
just usereturn $this
.customer_register_success