Magento 1.7 – Event/Observer for Customer Password Change

addresscustomerevent-observermagento-1.7

I'm looking for a way to hook into the event of customers changing their passwords. So if someone changes the password in the customer frontend, I'd like to send an e-mail somewhere.

I did consult the list over at http://www.nicksays.co.uk/magento-events-cheat-sheet-1-7/ but nothing looks like an event for changing passwords.

Best Answer

Thanks to Fabian Blechschmidt, I came up with the following that works for me (using the event customer_save_before):

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;
}