|
I was having problems where after certain customers (not all) tried logging in with their correct credentials they would get returned to the login page without being logged in and with no error message being displayed. I tried the cookie domain “fix” and the session validation settings “fix” both mentioned in this thread, but none of that helped. Finally I was able to find this: http://www.novusweb.com/1340/e-commerce-technology/fix-for-passing-magento-session-ids/ and everything has seemed to work smashingly since. (It’s been almost a week.)
In case the link disappears here’s a summary of the code changes:
Duplicate the file app/code/core/Mage/Customer/Model/session.php to app/code/local/Mage/Customer/Model/session.php so your changes don’t get overwritten when upgrading. Then (on line 216 in Magento CE 1.7.0.2) change the following:
public function login($username, $password) { /** @var $customer Mage_Customer_Model_Customer */ $customer = Mage::getModel('customer/customer') ->setWebsiteId(Mage::app()->getStore()->getWebsiteId());
if ($customer->authenticate($username, $password)) { $this->setCustomerAsLoggedIn($customer); $this->renewSession(); return true; } return false; }
to
public function login($username, $password) { /** @var $customer Mage_Customer_Model_Customer */ $customer = Mage::getModel('customer/customer') ->setWebsiteId(Mage::app()->getStore()->getWebsiteId());
if ($customer->authenticate($username, $password)) { $this->setCustomerAsLoggedIn($customer); // $this->renewSession(); // Commented out to fix customer login loop return true; } return false; }
All you’re doing is commenting out
$this->renewSession();
so that the customer’s session is not renewed upon logging in.
I haven’t received any reports so far that it has resulted in any unforeseen related issues. For a full rundown go here: http://www.novusweb.com/1340/e-commerce-technology/fix-for-passing-magento-session-ids/
I hope that helps someone else. And thank you, Bret Williams of Novusweb!
|