I'm experiencing terrible issue with M2 2.1.4.
I'm creating new user programmatically (without any issues) and then immediatelly I'm doing setCustomerAsLoggedIn():
/* Magento\Customer\Model\Customer $this->customer */ $loginCustomer = $this->customer->loadByEmail('email@example.com'); /* Magento\Customer\Model\Session $this->session */ $this->session->setCustomerAsLoggedIn($loginCustomer); ... return $resultRedirect->setPath('customer/account');
But on the top (instead of
"Sign In or Create Account") I can't see customer name. If I will log out and then log in - it will appear.
How to fix this problem and why this happening?
I check both modes (developer/production) and with cache/without cache.