If you have recently upgraded Magento, and you have a custom template, you will notice that you are unable to login as a customer into the site. The issue is raising because the custom login form does not contain any form_key and there is a form-key validation happening in loginPostAction of Magento. I have been fixing numerous sites recently, so I thought I’d share.
Here is the solution:
1 – Go to app/design/frontend/[Your-package]/[Your-theme]/template/customer/form/login.phtml
Find: <ul class=”form-list”>
and paste this right after the code above:
<input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>" />
See the Pen Bewri by Bss Commerce (@bssgroup) on CodePen.
2 – Go to app/design/frontend/Your-package]/[Your-theme]/template/persistent/customer/form/login.phtml and apply the same changes.
I hope this helps. Let’s Like, Share and Subscribe if you find this post useful for you
If you have any further questions, please contact us to get more explanation. We are certified Magento developers with a handful of Magento 2 extensions that are willing to help you every time.