2

Already I have used bellow code:

<input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />

In app/design/frontend/my theme/default/template/persistent/customer/form/register.phtml

Same code used in app/design/frontend/base/default/template/persistent/customer/form/login.phtml

But still not login or create user into chrome.

Any Solution for that??

here my code in register.phtml file.

<div class="account-create">
<div class="page-title">
    <h1><?php echo $this->__('Create an Account') ?></h1>
</div>
<?php echo $this->getChildHtml('form_fields_before')?>
<?php echo $this->getMessagesBlock()->toHtml() ?>
<form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="form-validate">
    <input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
    <div class="fieldset">
        <input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
        <input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
        <h2 class="legend"><?php echo $this->__('Personal Information') ?></h2>
        <ul class="form-list">
            <li class="fields">
                <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getFormData())->setForceUseCustomerAttributes(true)->toHtml() ?>
            </li>
            <li>
                <label for="email_address" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
                <div class="input-box">
                    <input type="text" name="email" id="email_address" value="<?php echo $this->escapeHtml($this->getFormData()->getEmail()) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Email Address')) ?>" class="input-text validate-email required-entry" />
                </div>
            </li>
            <?php if ($this->isNewsletterEnabled()): ?>
            <li class="control">
                <div class="input-box">
                    <input type="checkbox" name="is_subscribed" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Sign Up for Newsletter')) ?>" value="1" id="is_subscribed"<?php if($this->getFormData()->getIsSubscribed()): ?> checked="checked"<?php endif; ?> class="checkbox" />
                </div>
                <label for="is_subscribed"><?php echo $this->__('Sign Up for Newsletter') ?></label>
            </li>

Same thing, login.phtml file

<div class="account-login">
<div class="page-title">
    <h1><?php echo $this->__('Login or Create an Account') ?></h1>
</div>
<div class="white-bg">
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
<form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="login-form">
<?php //echo $this->getBlockHtml('formkey'); ?>
    <div class="grid_6 no-left-margin">
        <div class="registered-users">
            <div class="content">
                <h2><?php echo $this->__('Registered Customers') ?></h2>
                <p><?php echo $this->__('If you have an account with us, please log in.') ?></p>
                <ul class="form-list">
                    <input type="hidden" value="<? echo Mage::getSingleton('core/session')->getFormKey(); ?>" name="form_key" />
                    <li>
                        <label for="email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
                        <div class="input-box">
                            <input type="text" placeholder="E-MAIL OR LOGIN" name="login[username]" value="<?php echo $this->escapeHtml($this->getUsername()) ?>" id="email" class="input-text required-entry validate-email" title="<?php echo $this->__('Email Address') ?>" />
                        </div>
                    </li>
                    <li>
                        <label for="pass" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
                        <div class="input-box">
                            <input type="password" placeholder="PASSWORD" name="login[password]" class="input-text required-entry validate-password" id="pass" title="<?php echo $this->__('Password') ?>" />
                        </div>
                    </li>
6
  • `can you post how you add code of form key?
    – ND17
    Feb 15, 2016 at 11:27
  • Did you try enabling template path hints and ensure your template is not getting overidden by a 3rd party module ? Feb 15, 2016 at 11:29
  • Also try flushing your browser cookies and var/session Feb 15, 2016 at 11:29
  • Hi @DigitalPianism, yes I have checked it, not override with 3rd party extension. And also, clear all cache and browser cookie, but still not work.
    – Dhrumin
    Feb 15, 2016 at 12:40
  • Does it happen on Firefox too ? Feb 15, 2016 at 12:54

2 Answers 2

2

Uncomment

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

in login.phtml

In register.phtml
Change from <input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" /> to <?php echo echo $this->getBlockHtml('formkey'); ?>

1

If it's a Chrome specific issue, you'd try to check your .htaccess file, and disable any mod_expires directive for html files. I have experienced some issues with this in the past, as Chrome cache seems to work more than desired

Other problem could be cookies, I assume you have cookies enabled for Chrome. If that's the case be sure to clean all stored cookies (this can be a bit tricky with Chrome, the right way to do is: Settings > History > Clear browsing data > select cookies, discard doing it with any plugin or extension)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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