How to Change Minimum Password Length for Customers in SOAP API

apimagento-1.8Securitysoap

TL;DR: how do I change the minimum password length requirement for customers created via the SOAP v2 API?

I need to change the minimum password length requirement for customers created via the SOAP V2 API but can't find which file(s) I need to edit. I've tried using grep to check for occurrences of the password length being checked but only found the front-end code for that. It seems like there is some mapping between the SOAP layer and the model layer I'm not aware of, any pointers would be appreciated.

EDIT: So I realised that I was using grep with the case sensitive mode, which was excluding everything, since all the soap files are named Soap.php. Still looking, though.

Best Answer

Customer creation

I assume you're using the standard customerCustomerCreate() SOAP v2 Method.

This method is referenced in app/code/core/Mage/Customer/etc/wsdl.xml (grep for: "customerCustomerCreate"). The method create is defined in Model/Customer/Api.php where you can see that the customer/customer Model is called:

class Mage_Customer_Model_Customer_Api extends Mage_Customer_Model_Api_Resource
{
 ....
/**
 * Create new customer
 *
 * @param array $customerData
 * @return int
 */
public function create($customerData)
{
    $customerData = $this->_prepareData($customerData);
    try {
        $customer = Mage::getModel('customer/customer')
            ->setData($customerData)
            ->save();
    } catch (Mage_Core_Exception $e) {
        $this->_fault('data_invalid', $e->getMessage());
    }
    return $customer->getId();
}
... 
}

The Mage_Customer_Model_Customer_Api_V2 class extends Mage_Customer_Model_Customer_Api. So you'll need a bit of effort just to change it for the created customers via SOAP.

The password length is hardcoded in Mage_Customer_Model_Customer_Attribute_Backend_Password (see: $len = Mage::helper('core/string')->strlen($password); and if ($len < 6) ).