I'm trying to get a login form that has been called by a CMS page to work but when tested, it redirects back to the page and doesn't log the user in.
I guess this is to do with not having the right form key as I notice the default login page has the URL format,
www.mydomain.com/customer/account/login/referer/blahblahblah/
and the form calls the function, getPostActionUrl() which generates this URL for the form action,
www.mydomain.com/customer/account/loginPost/referer/blahblahblah/
So how do I get my form to use that blahblahblah key?
The form does generate a hidden input called form_key. This isn't the same as blahblahblah though.
Here is the code of the form. Can anyone suggest how to get the blahblahblah key and where to drop it in the form code?
<div class="block block-login"> <div class="block-title"> <strong><span><?php echo $this->__('Login') ?></span></strong> </div> <?php echo $this->getChildHtml('customer.form.login.extra')?><form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="login-form"> <?php echo $this->getBlockHtml('formkey'); ?> <div class="block-content"> <label for="mini-login"><?php echo $this->__('Email:') ?></label> <input type="text" name="login[username]" value="<?php echo $this->escapeHtml($this->getUsername()) ?>" id="email" class="input-text required-entry validate-email" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Email Address')) ?>" /> <label for="mini-password"><?php echo $this->__('Password:') ?></label> <input type="password" name="login[password]" class="input-text required-entry validate-password" id="pass" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Password')) ?>" /> <div class="actions"> <button type="submit" class="button" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Login')) ?>" name="send" id="send2"><span><span><?php echo $this->__('Login') ?></span></span></button> </div> </div> </form> <script type="text/javascript">//<![CDATA[ var dataForm = new VarienForm('login-form', true); //]]>