I have added a mini login for in topmenu using code
<?php echo $this->getLayout()->createBlock('customer/form_login')->setTemplate('customer/form/mini.login.phtml')->toHtml();
code of my mini.login.phtml
file is
<form method="post" id="login-form" action="<?php echo $this->getPostActionUrl() ?>">
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
<ul>
<li>
<span class="logincon"></span>
<input type="text" name="login[username]" title="<?php echo $this->__('Enter your Email-id to Login'); ?>" id="email" class="input-text required-entry validate-email logintex" placeholder="Email-id"/>
<!-- <?php //echo $this->__('Email-id'); ?> -->
</li>
<li>
<span class="logincon"></span>
<input type="password" title="<?php echo $this->__('Enter your password here'); ?>" name="login[password]" id="pass" class="input-text required-entry validate-password logintex" placeholder="Password"/>
<!-- <?php //echo $this->__('Password'); ?> -->
</li>
<li class="forgotpass">
<a href="<?php echo Mage::getBaseUrl() . "customer/account/forgotpassword/"; ?>">Forgot Password?</a>
</li>
<li class="forgotpass">
<input type="submit" class="submit" title="<?php echo $this->__('Click here to Login'); ?>" value="<?php echo $this->__('Sign In'); ?>"/>
</li>
</ul>
</form>
<script type="text/javascript">
//<![CDATA[
var dataForm = new VarienForm('login-form', true);
//]]>
</script>
The problem is that even after adding form key code , customer can not login from mini login form, the reason I found for this is form key is not valid. I checked login form and mini login form have different formkey when I copied login page form key to mini login form it worked.
When I cleared all magento cache and session with browser's cookie and cache, then both the form generated same formkey and mini login worked , but after some time when try to login from another browser (even in same browser and private browsing) the issue occurs again. is there any permanant solution or alternate way to login from mini login form?