I need to logout a user after successful registration to login page.
I tried to redirect the user after registration by creating a observer customer_register_success but it dint work, When the observer is called the loggin action is not triggered so I added a redirection that will solve my problem but dint. its working as usual.
public function execute(Observer $observer)
{
$this->messageManager->addErrorMessage(__('Your account is not approved.'));
$this->_response->setRedirect($this->_urlFactory->create()->getUrl('customer/account/login'));
}
I tried with this link belo but it only works with login page and not in registration process.
How do I Logout the user.