Reputation: 99
I just migrated my website. But I got a problem.
My customers can't log in to their account. When click log in on log-in page. http://www.mywebsite.com/customer/account/login/ It should be log in on their account but it redirects the same page.
Please Help me how to fix that?
Upvotes: 6
Views: 12539
Reputation: 99
Go to template/customer/form/login.phtml
and template/persistent/customer/form/login.phtml
and under
<ul class="form-list">
Add the following code in the login form
<input type="hidden" name="form_key" value="<? echo Mage::getSingleton('core/session')->getFormKey(); ?>" />
OR, if you are using the login form in several places with different template files
Copy app/code/core/Mage/Customer/controllers/AccountController.php
to app/code/local/Mage/Customer/controllers/AccountController.php
Open the AccountController.php that you have copied to local and add the following code to line 139 just after the opening of loginPostAction()
// generate form_key if missing or invalid
if (!($formKey = $this->getRequest()->getParam('form_key', null)) || $formKey != Mage::getSingleton('core/session')->getFormKey()) {
$this->getRequest()->setParams(array('form_key' =>Mage::getSingleton('core/session')->getFormKey()));
}
http://www.blueclawsearch.co.uk/blog/2013/12/12/fix-customer-cannot-login-to-magento-1-8-1/
Upvotes: 0
Reputation: 341
After upgrading to Magento 1.8.1 you need to edit your existing template files.
The files listed below need te be change in order to be compatible with Magento 1.8.1. If they exist in your custom theme, compare them to the original base/default/template
files.
your_package/your_theme/template/customer/form/newsletter.phtml
your_package/your_theme/template/customer/form/login.phtml
your_package/your_theme/template/customer/form/edit.phtml
your_package/your_theme/template/customer/address/edit.phtml
your_package/your_theme/template/whishlist/view.phtml
your_package/your_theme/template/whishlist/sharing.phtml
your_package/your_theme/template/review/form.phtml
your_package/your_theme/template/persistent/customer/form/login.phtml
your_package/your_theme/template/persistent/checkout/onepage/login.phtml
your_package/your_theme/template/checkout/onepage/login.phtml
your_package/your_theme/template/checkout/multishipping/overview.phtml
your_package/your_theme/template/checkout/cart.phtml
your_package/your_theme/template/catalog/product/view.phtml
your_package/your_theme/template/sendfriend/send.phtml
your_package/your_theme/template/sales/reorder/sidebar.phtml
Edit these files and add <?php echo $this->getBlockHtml('formkey'); ?>
after the <form ...>
open tag
Upvotes: 24
Reputation: 964
Step 1: Web_Customer.xml
- Enabling custom module:
<?xml version=”1.0″?>
<config>
<modules>
<Web_Customer>
<active>true</active>
<codePool>local</codePool>
</Web_Customer>
</modules>
</config>
Step 2: config.xml
– Configuration for our module:
<?xml version=”1.0″?>
<config>
<modules>
<Web_Customer>
<version>0.0.1</version>
</Web_Customer>
</modules>
<frontend>
<routers>
<customer><!– Name of core module to be overridden–>
<args>
<modules>
<Web_Customer before=”Mage_Customer”>Web_Customer</Web_Customer><!– Tell Magento to call our custom module before the Mage/Checkout module –>
</modules>
</args>
</customer>
</routers>
</frontend>
</config>
Step 3: Add the following code to line 139 just after the opening of loginPostAction()
in AccountController.php
<?php
require_once(“Mage/Customer/controllers/AccountController.php”);
class Web_Customer_AccountController extends Mage_CUstomer_AccountController{
public function loginPostAction()
{
// generate form_key if missing or invalid
if (!($formKey = $this->getRequest()->getParam(‘form_key’, null)) || $formKey != Mage::getSingleton(‘core/session’)->getFormKey()) {
$this->getRequest()->setParams(array(‘form_key’ =>Mage::getSingleton(‘core/session’)->getFormKey()));
}
//Note*
// rest code is same as from Mage/Customer/controllers/AccountController.php
}
}
?>
After completing, don’t forget to clear Magento cache.
Upvotes: 0