/** * Validate customer attribute values. * For existing customer password + confirmation will be validated only when password is set (i.e. its change is requested) * * @return bool */ public function validate() { if (Mage::helper('onestepcheckout')->enabledOnestepcheckout()) { return true; } return parent::validate(); }
public function validate() { $errors = parent::validate(); if (!$this->_helper->isEnabled()) { return $errors; } if (!is_array($errors)) { $errors = array(); } $this->_clearRedefinedValidationsErrors($errors); $password = $this->getPassword(); $minPasswordLength = $this->_helper->getPasswordMinLength(); if (strlen($password) && !Zend_Validate::is($password, 'StringLength', array($minPasswordLength))) { $errors[] = Mage::helper('customer')->__('The minimum password length is %s', $minPasswordLength); } if ($this->_isPasswordWasAlreadyInUse()) { $errors[] = $this->_helper->__('Password was already used by you some times ago. Use new password.'); } if (empty($errors)) { return true; } return $errors; }
/** * Do validation of customer and its address using validate methods in models * * @param Mage_Customer_Model_Customer $customer * @param Mage_Customer_Model_Address|null $address * @throws Magento_Validator_Exception */ protected function _validateCustomer($customer, $address = null) { $errors = array(); if ($address) { $addressErrors = $address->validate(); if (is_array($addressErrors)) { $errors = array_merge($errors, $addressErrors); } } $customerErrors = $customer->validate(); if (is_array($customerErrors)) { $errors = array_merge($errors, $customerErrors); } if (count($errors) > 0) { throw new Magento_Validator_Exception(array($errors)); } }
public function validate() { $errors = parent::validate(); }