Magento Core Functions and Classes MasterPassword is overriding

MasterPassword is overriding some Magento Core Classes. So when experiencing conflicts with other Extensions, or having lost store customizations with MasterPassword being installed, these are the Classes it is overriding from the Magento Core:

Magento Core Classby MasterPassword rewritten toRemarks
Mage/Customer/Model/Customer.phpPisc/Masterpassword/Model/Customer.phpTo extend the Core Customer Model to allow password override and to introduce the events.



In case of Magento Core classes overridden by other extensions, or own customizations, be aware that you might need to consolidate these changes into one of these classes. To keep the MasterPassword functionality in such case.



Look into the directories:

  • app/code/community
  • app/code/local

For each Extension to be found in these directories, check the etc/config.xml if the Customer/Customer Core Model is being rewritten like this:

config.xml

    <global>
        <models>
	    <customer>
	      	<rewrite>
                    <customer>Some_Other_Model_Here</customer>
	        </rewrite>
	    </customer>
        </models>
    </global>



Find the model file to which the Core Customer Model is being written (shown here as Some_Other_Model_Here) and modify the validatePassword function as described in the following.

Open the configuration file of MasterPassword and comment out the shown section to prevent rewriting the Magento Core Model:

app/code/local/Pisc/MasterPassword/etc/config.xml

    <global>
        <models>
            <masterpassword>
                <class>Pisc_Masterpassword_Model</class>
            </masterpassword>
 
<!-- To prevent conflicts with other Extensions
	        <customer>
	        	<rewrite>
	        	  <customer>Pisc_Masterpassword_Model_Customer_Customer</customer>
	        	</rewrite>
	        </customer>
-->
        </models>



In the Customer Model Class of the Extension - that is causing the conflict - add this Event or modify the code similar to as shown here:

Customer.php

    /**
     * Validate password with salted hash
     *
     * @param string $password
     * @return boolean
     */
    public function validatePassword($password)
    {
    	/*
        if (!($hash = $this->getPasswordHash())) {
            return false;
        }
        return Mage::helper('core')->validateHash($password, $hash);
        */
 
        // Replaced with this Event to handle the Password validation through MasterPassword
    	return Mage::getModel('masterpassword/customer_customer')->validatePassword($password, $this);
    }