public function save($runValidation = true, array $attributeNames = null) { $passwordChanged = array_key_exists('hash', $this->originalAttributeValues); unset($this->originalAttributeValues['hash']); assert('!isset($this->originalAttributeValues["hash"])'); $saved = parent::save($runValidation, $attributeNames); if ($saved && $passwordChanged) { AuditEvent::logAuditEvent('UsersModule', UsersModule::AUDIT_EVENT_USER_PASSWORD_CHANGED, $this->username, $this); } if ($saved) { $this->setIsActive(); } return $saved; }