This one is a bit tricky without rewriting the controller action but this should work. I called my example extension Emzee_ForgotPasswordRedirect
.
What it does: after the normal action for creating the forgott password email and redirect instruction has happened, an observer hooks into the postdispatch event of the action, checks if an success action (and no error message) is saved in the customer session and overwrites the redirect to redirect to the homepage.
Caveat: checking for the session messages is a bit hacky but there is no other way to tell whether the forgot password action was successful or not.
XML extension activation file app/etc/modules/Emzee_ForgotPasswordRedirect.xml
:
<?xml version="1.0"?>
<config>
<modules>
<Emzee_ForgotPasswordRedirect>
<active>true</active>
<codePool>community</codePool>
<depends></depends>
</Emzee_ForgotPasswordRedirect>
</modules>
</config>
XML extension configuration file app/code/community/Emzee/ForgotPasswordRedirect/etc/config.xml
:
<?xml version="1.0"?>
<config>
<modules>
<Emzee_ForgotPasswordRedirect>
<version>1.0.0</version>
</Emzee_ForgotPasswordRedirect>
</modules>
<frontend>
<events>
<controller_action_postdispatch_customer_account_forgotpasswordpost>
<observers>
<emzee_forgotpasswordredirect>
<class>emzee_forgotpasswordredirect/observer</class>
<method>setForgotPasswordRedirect</method>
</emzee_forgotpasswordredirect>
</observers>
</controller_action_postdispatch_customer_account_forgotpasswordpost>
</events>
</frontend>
<global>
<models>
<emzee_forgotpasswordredirect>
<class>Emzee_ForgotPasswordRedirect_Model</class>
</emzee_forgotpasswordredirect>
</models>
</global>
</config>
Observer app/code/community/Emzee/ForgotPasswordRedirect/Model/Observer.php
:
<?php
class Emzee_ForgotPasswordRedirect_Model_Observer
{
/**
* @param Varien_Event_Observer $observer
* @return Emzee_ForgotPasswortRedirect_Model_Observer
*/
public function setForgotPasswordRedirect(Varien_Event_Observer $observer)
{
$controller = $observer->getEvent()->getControllerAction();
$sessionMessages = Mage::getSingleton('customer/session')->getMessages();
if ($sessionMessages->count(Mage_Core_Model_Message::SUCCESS) > 0 &&
$sessionMessages->count(Mage_Core_Model_Message::ERROR) === 0) {
$controller->setRedirectWithCookieCheck('/');
}
return $this;
}
}
If you want to redirect to the checkout instead to the homepage, replace
$controller->setRedirectWithCookieCheck('/');
with
$controller->setRedirectWithCookieCheck('checkout/onepage');
Best Answer
Go to
System > Configuration > Web
ExpandSession Cookie Managemen
t Set the following:Cookie Path: / Cookie Domain: yoursite.com Use HTTP Only: Yes.
Got tovar/sessions
and clear folder.Try again...you should be ok.