I am using custom login form in my magento site. I below mention my custom code

    <?php echo $this->getChildHtml('customer.form.login.extra')?>
            <div class="market_place_login_ctrl">
                <form action="<?php echo Mage::getBaseUrl();?>customer/account/loginPost/" method="post" id="login-form" class="market_place_login_ctrl">
                            <?php echo $this->getBlockHtml('formkey'); ?>
                             <div class="col-md-5">
                                <div class="row">
                                    <input type="text" name="login[username]" placeholder="Your Email ID (username)" value="<?php echo $this->escapeHtml($this->getUsername()) ?>" id="email" class="input-text required-entry validate-email" title="<?php echo $this->__('Email Address') ?>" />
                            <div class="col-md-5">
                                <div class="row">
                                    <input type="password" name="login[password]" placeholder="Password" class="input-text required-entry validate-password" id="pass" title="<?php echo $this->__('Password') ?>" />
                            <div class=" col-md-2">
                                <div class="row">
                                <button type="submit" class="button" title="<?php echo $this->__('Login') ?>" name="send" id="send2"><span ><span><?php echo $this->__('Login') ?></span></span></button>
                           <a href="<?php echo Mage::getUrl('customer/account/forgotpassword') ?>">Forgot password?</a>

                             <?php echo $this->getChildHtml('form.additional.info'); ?>

    <script type="text/javascript">
        var dataForm = new VarienForm('login-form', true);

But my problem is if customer successfully logged in it redirect to customer account else wrong username or wrong password it won't display any error message. it just reload the page. How i fix it?


You are not echoing message block in your custom login phtml file. So put the message block inside login phtml will resolve this issue.

Put this code just above the form declaration

  <?php echo $this->getMessagesBlock()->toHtml() ?>
| improve this answer | |
  • if i use this it won't throw any error. success login my account page show error useername and password – Magento 2 Sep 22 '15 at 7:34
  • @LearningMagento you need to put that code in the template file where you need to show messages. If you put this in login phtml file, you can see messages only if login fails and you are then redirecting to your same custom login page. (here i assume you are using your controller to set messages). If you successfully logged in, you may redirected to another page. if you show success message, then you should put the same code in that template file. – Rajeev K Tomy Sep 22 '15 at 7:47
  • actually i m using default login file in different page – Magento 2 Sep 22 '15 at 7:48
  • default login phtml file is customer/form/login.phtml and it does hold that code in that file already. – Rajeev K Tomy Sep 22 '15 at 7:50
  • but it won't throw any error – Magento 2 Sep 22 '15 at 7:54

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.