2

I am new to magento, I am learning step by step with all your help. Thanks..

I have done admin login from the frontend. I have separate login for admin at front end footer, I did it successfully but when user-name and password is wrong then it redirect magento admin login form and display the error.

I don't need like that, I have to redirect it to front with error message.

Thanks in advance...

closed as off-topic by David Manners, Mufaddal, Marius Dec 9 '14 at 11:45

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on problems in code you've written must describe the specific problem and include valid code to reproduce it. For help writing short, self-contained syntactically-valid examples, see: http://sscce.org/" – David Manners, Mufaddal, Marius
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Put your code here. – Amit Bera Jul 28 '14 at 10:37
2

If you do the login with a form that points to /admin/index/login, you can add an additional hidden field to the form, for example is_login_from_frontend and check if this parameter is set in an observer for controller_action_postdispatch_admin_index_login like this:

public function redirectToFrontendAfterLoginFromFrontend(Varien_Event_Observer $observer)
{
    if (Mage::getSingleton('admin/session')->isLoggedIn()) {
        return; // never redirect if login was successful
    }
    $controller = $this->getControllerAction();
    if ($controller->getRequest()->getPost('is_login_from_frontend')) {
        $controller->getResponse()->setRedirect($controller->getUrl('/'));
    }
}

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