Magento - 在检查之前更改忘记密码的电子邮件

Magento - change email in forgotpassword before check it

在忘记密码的表单中,我需要获取电子邮件并在 magento 检查之前更改它。

为什么?因为我需要将客户个人号码(如 9834592845)更改为他们在数据库中的电子邮件存储 (bla@ble.bli)

我在活动中工作: controller_action_predispatch_customer_account_forgotpassword

但是我收不到邮件,我试过了

$username = $observer->getRequest()->getPost('email');
$username = $observer->getRequest()->getPost();
$postData = Mage::app()->getRequest()->getPost();
$username = $observer->getData('email');
$username = $observer->getEmail();
$username = $_POST;
$username = $_POST['login']['username'];
$username = $_POST['login']['email'];
Mage::log($username);

还有更多,但没有。

我做错了什么。

感谢任何帮助。

您可以使用 customer_save_before Observer,因为您可以编写自己的代码

示例:

public function detectPwdChange(Varien_Event_Observer $observer) {
    $event              = $observer->getEvent();
    $customer           = $event->getCustomer();
    $postData           = Mage::app()->getRequest()->getPost();

    if($customer instanceof Mage_Customer_Model_Customer && !$customer->isObjectNew()) {

        if( $postData['change_password'] == 1 && $postData['current_password'] != $postData['password'] ) {
            // Do something
        }
    }

    return $this;
}