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.

I'm very new to magento. Please Help me how to fix that?


Do you have a custom template and did it work in 1.7? In 1.8.1 form_keys were added, so please check your custom template for this line:

<?php echo $this->getBlockHtml('formkey'); ?>

if it is missing, add it as in


And check all other forms after the update:


| improve this answer | |
  • Dear sir, I don't have a custom template.I didn't touch the core file. And <?php echo $this->getBlockHtml('formkey'); ?> is not missing. Any suggestion? – Nattapong Lip Kiatmongkollert Dec 13 '13 at 15:12
  • 1
    Please stop calling me sir :) And no, was the only idea I had :-( – Fabian Blechschmidt Dec 13 '13 at 15:21
  • 1
    this is the problem I described ;-) Great you fixed it! – Fabian Blechschmidt Dec 15 '13 at 13:26
  • Anyway, Thanks for your help. Really glad. :) – Nattapong Lip Kiatmongkollert Dec 16 '13 at 10:56

http://www.blueclawsearch.co.uk/blog/2013/12/12/fix-customer-cannot-login-to-magento-1-8-1/ this is a solution for the problem

Here's what the above link has to say:

  • 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="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>" />

If you are using the login form in different templates then you use add the form_key to the other parts as well.

| improve this answer | |
  • 5
    Nothing but a link to a solution is not appropriate on Stack Exchange sites because it may encourage link spam. Also, external links may change over time braking this 'solution'. Please post the solution here and reference the source link after if you like. – shanemgrey Jan 28 '14 at 23:12
  • As shaneveeg warned, the link is now broken, leaving the rest of us in this state. – toon81 Aug 3 '15 at 9:24

I have done this in /app/Mage/Customer/controllers/AccountController.php

I made this changes and it began to work for me

 * Login post action
public function loginPostAction()

    // generate form_key if missing or invalid
    if (!($formKey = $this->getRequest()->getParam('form_key', null))
            || $formKey != Mage::getSingleton('core/session')->getFormKey()) {
            'form_key' =>Mage::getSingleton('core/session')->getFormKey()
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.