private static function executeManageChangePassword(&$error) { $error = false; $userId = $_REQUEST['USER_ID']; $password = $_REQUEST['password']; $password2 = $_REQUEST['password2']; if (!check_bitrix_sessid()) { $error = GetMessage('INTR_MAIL_CSRF'); } if ($error === false) { $mailbox = CIntranetMailSetupHelper::getUserMailbox($userId); if (empty($mailbox) || !in_array($mailbox['SERVER_TYPE'], array('controller', 'domain', 'crdomain'))) { $error = GetMessage('INTR_MAIL_FORM_ERROR'); } } if ($error === false) { if ($password != $password2) { $error = GetMessage('INTR_MAIL_INP_PASSWORD2_BAD'); } } if ($error === false) { list($login, $domain) = explode('@', $mailbox['LOGIN'], 2); if ($mailbox['SERVER_TYPE'] == 'domain') { $domainService = CIntranetMailSetupHelper::getDomainService($mailbox['SERVICE_ID']); $result = CMailDomain2::changePassword($domainService['token'], $domain, $login, $password, $error); if (is_null($result)) { $error = CMail::getErrorMessage($error); } } else { if ($mailbox['SERVER_TYPE'] == 'crdomain') { $crResponse = CControllerClient::ExecuteEvent('OnMailControllerChangeMemberPassword', array('DOMAIN' => $domain, 'NAME' => $login, 'PASSWORD' => $password)); if (!isset($crResponse['result'])) { $error = empty($crResponse['error']) ? GetMessage('INTR_MAIL_CONTROLLER_INVALID') : CMail::getErrorMessage($crResponse['error']); } } else { if ($mailbox['SERVER_TYPE'] == 'controller') { $crResponse = CControllerClient::ExecuteEvent('OnMailControllerChangePassword', array('DOMAIN' => $domain, 'NAME' => $login, 'PASSWORD' => $password)); if (!isset($crResponse['result'])) { $error = empty($crResponse['error']) ? GetMessage('INTR_MAIL_CONTROLLER_INVALID') : CMail::getErrorMessage($crResponse['error']); } } } } } return array('result' => $error === false ? 'ok' : 'error', 'error' => CharsetConverter::ConvertCharset($error, SITE_CHARSET, 'UTF-8')); }