/** * Validate the form * * As it is better for translation utilities to set the labels etc. translated, * the MUtil default is to disable translation. * * However, this also disables the translation of validation messages, which we * cannot set translated. The MUtil form is extended so it can make this switch. * * @param array $data * @param boolean $disableTranslateValidators Extra switch * @return boolean */ public function isValid($data, $disableTranslateValidators = null) { $valid = parent::isValid($data, $disableTranslateValidators); if ($valid === false && $this->forceRules === false) { $messages = $this->getMessages(); // If we don't enforce password rules, we pass validation but leave error messages in place. if (count($messages) == 1 && array_key_exists('new_password', $messages)) { $valid = true; } } if ($valid) { $this->user->setPassword($data['new_password']); } else { if ($this->getAskOld() && isset($data['old_password'])) { if ($data['old_password'] === strtoupper($data['old_password'])) { $this->addError($this->_('Caps Lock seems to be on!')); } } $this->populate($data); } return $valid; }