API user registration functions ENV params
This commit is contained in:
parent
3a9e3a73af
commit
4a4d2898a0
147
api/index.php
147
api/index.php
@ -377,14 +377,17 @@ switch($PARAM_1)
|
||||
$company_message = "Вам предоставлен доступ к Личному кабинету следующей организации:<br><br>\n\n";
|
||||
$company_message .= $REQ['org_title'].", ИНН: ".$REQ['inn']."<br>\n";
|
||||
|
||||
\Bitrix\Main\Mail\Event::send([
|
||||
"EVENT_NAME" => "CLIENT_USER_INVITE",
|
||||
"LID" => "s1",
|
||||
"C_FIELDS" => Array(
|
||||
"EMAIL" => $REQ['email'],
|
||||
"COMPANIES" => $company_message,
|
||||
)
|
||||
]);
|
||||
if(SEND_EMAIL_REGISTRATION_JOIN)
|
||||
{
|
||||
\Bitrix\Main\Mail\Event::send([
|
||||
"EVENT_NAME" => "CLIENT_USER_INVITE",
|
||||
"LID" => "s1",
|
||||
"C_FIELDS" => Array(
|
||||
"EMAIL" => $REQ['email'],
|
||||
"COMPANIES" => $company_message,
|
||||
)
|
||||
]);
|
||||
}
|
||||
|
||||
$user_properties = [
|
||||
'COMPANY' => $REQ['org_title'],
|
||||
@ -464,16 +467,19 @@ switch($PARAM_1)
|
||||
$ID = $user->Add($profile);
|
||||
if (intval($ID) > 0)
|
||||
{
|
||||
\Bitrix\Main\Mail\Event::send([
|
||||
"EVENT_NAME" => "USER_INFO",
|
||||
"LID" => "s1",
|
||||
"C_FIELDS" => Array(
|
||||
"EMAIL" => $REQ['email'],
|
||||
"ORG_NAME" => $REQ['org_title'],
|
||||
"LOGIN" => $REQ['email'],
|
||||
"PASS" => $REQ['password'],
|
||||
)
|
||||
]);
|
||||
if(SEND_EMAIL_REGISTRATION_CREATE)
|
||||
{
|
||||
\Bitrix\Main\Mail\Event::send([
|
||||
"EVENT_NAME" => "USER_INFO",
|
||||
"LID" => "s1",
|
||||
"C_FIELDS" => Array(
|
||||
"EMAIL" => $REQ['email'],
|
||||
"ORG_NAME" => $REQ['org_title'],
|
||||
"LOGIN" => $REQ['email'],
|
||||
"PASS" => $REQ['password'],
|
||||
)
|
||||
]);
|
||||
}
|
||||
|
||||
//new user & new company
|
||||
setCompanyForUser($ID, $REQ);
|
||||
@ -564,16 +570,19 @@ switch($PARAM_1)
|
||||
$user = new \CUser;
|
||||
$user->Update($user_registered, $profile);
|
||||
|
||||
\Bitrix\Main\Mail\Event::send([
|
||||
"EVENT_NAME" => "USER_INFO",
|
||||
"LID" => "s1",
|
||||
"C_FIELDS" => Array(
|
||||
"EMAIL" => $REQ['email'],
|
||||
"ORG_NAME" => (string)$REQ['org_title'],
|
||||
"LOGIN" => $REQ['email'],
|
||||
"PASS" => $REQ['password'],
|
||||
)
|
||||
]);
|
||||
if(SEND_EMAIL_REGISTRATION_UPDATE)
|
||||
{
|
||||
\Bitrix\Main\Mail\Event::send([
|
||||
"EVENT_NAME" => "USER_INFO",
|
||||
"LID" => "s1",
|
||||
"C_FIELDS" => Array(
|
||||
"EMAIL" => $REQ['email'],
|
||||
"ORG_NAME" => (string)$REQ['org_title'],
|
||||
"LOGIN" => $REQ['email'],
|
||||
"PASS" => $REQ['password'],
|
||||
)
|
||||
]);
|
||||
}
|
||||
|
||||
print json_encode([
|
||||
"status" => "success"
|
||||
@ -613,16 +622,19 @@ switch($PARAM_1)
|
||||
//new user & new company
|
||||
setCompanyForUser($ID, $REQ, true);
|
||||
|
||||
\Bitrix\Main\Mail\Event::send([
|
||||
"EVENT_NAME" => "USER_INFO",
|
||||
"LID" => "s1",
|
||||
"C_FIELDS" => Array(
|
||||
"EMAIL" => $REQ['email'],
|
||||
"ORG_NAME" => $REQ['org_title'],
|
||||
"LOGIN" => $REQ['email'],
|
||||
"PASS" => $REQ['password'],
|
||||
)
|
||||
]);
|
||||
if(SEND_EMAIL_REGISTRATION_COMPANY_NEW_USER)
|
||||
{
|
||||
\Bitrix\Main\Mail\Event::send([
|
||||
"EVENT_NAME" => "USER_INFO",
|
||||
"LID" => "s1",
|
||||
"C_FIELDS" => Array(
|
||||
"EMAIL" => $REQ['email'],
|
||||
"ORG_NAME" => $REQ['org_title'],
|
||||
"LOGIN" => $REQ['email'],
|
||||
"PASS" => $REQ['password'],
|
||||
)
|
||||
]);
|
||||
}
|
||||
|
||||
print json_encode([
|
||||
"status" => "success"
|
||||
@ -997,26 +1009,32 @@ switch($PARAM_1)
|
||||
|
||||
if($existed_user)
|
||||
{
|
||||
\Bitrix\Main\Mail\Event::send([
|
||||
"EVENT_NAME" => "CLIENT_USER_INVITE",
|
||||
"LID" => "s1",
|
||||
"C_FIELDS" => Array(
|
||||
"EMAIL" => $auth['email'],
|
||||
"COMPANIES" => $companies_list_message,
|
||||
)
|
||||
]);
|
||||
if(SEND_EMAIL_REGISTRATION_COMPANY_INVITE)
|
||||
{
|
||||
\Bitrix\Main\Mail\Event::send([
|
||||
"EVENT_NAME" => "CLIENT_USER_INVITE",
|
||||
"LID" => "s1",
|
||||
"C_FIELDS" => Array(
|
||||
"EMAIL" => $auth['email'],
|
||||
"COMPANIES" => $companies_list_message,
|
||||
)
|
||||
]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
\Bitrix\Main\Mail\Event::send([
|
||||
"EVENT_NAME" => "CLIENT_NEW_USER_INVITE",
|
||||
"LID" => "s1",
|
||||
"C_FIELDS" => Array(
|
||||
"EMAIL" => $auth['email'],
|
||||
"PASSWORD" => $password,
|
||||
"COMPANIES" => $companies_list_message,
|
||||
)
|
||||
]);
|
||||
if(SEND_EMAIL_REGISTRATION_COMPANY_INVITE_NEW_USER)
|
||||
{
|
||||
\Bitrix\Main\Mail\Event::send([
|
||||
"EVENT_NAME" => "CLIENT_NEW_USER_INVITE",
|
||||
"LID" => "s1",
|
||||
"C_FIELDS" => Array(
|
||||
"EMAIL" => $auth['email'],
|
||||
"PASSWORD" => $password,
|
||||
"COMPANIES" => $companies_list_message,
|
||||
)
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
print json_encode([
|
||||
@ -1958,14 +1976,17 @@ switch($PARAM_1)
|
||||
|
||||
if(is_array($ar_user))
|
||||
{
|
||||
\Bitrix\Main\Mail\Event::send([
|
||||
"EVENT_NAME" => "USER_PASSWORD_RECOVERY_CODE",
|
||||
"LID" => "s1",
|
||||
"C_FIELDS" => Array(
|
||||
"EMAIL" => $REQ['email'],
|
||||
"CODE" => $REQ['code'],
|
||||
)
|
||||
]);
|
||||
if(SEND_EMAIL_PASSWORD_RECOVERY_CODE)
|
||||
{
|
||||
\Bitrix\Main\Mail\Event::send([
|
||||
"EVENT_NAME" => "USER_PASSWORD_RECOVERY_CODE",
|
||||
"LID" => "s1",
|
||||
"C_FIELDS" => Array(
|
||||
"EMAIL" => $REQ['email'],
|
||||
"CODE" => $REQ['code'],
|
||||
)
|
||||
]);
|
||||
}
|
||||
|
||||
print json_encode([
|
||||
"status" => "success",
|
||||
|
||||
@ -27,6 +27,9 @@ if(!empty($arParams['CITY']['LEADER_CRM_ID']))
|
||||
curl_setopt($c, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
|
||||
|
||||
$response = curl_exec($c);
|
||||
//print "<!-- TEAMTEAMTEAM";
|
||||
//print_r($response);
|
||||
//print "-->";
|
||||
$httpcode = curl_getinfo($c, CURLINFO_HTTP_CODE);
|
||||
|
||||
curl_close($c);
|
||||
|
||||
@ -473,24 +473,6 @@ if($this->StartResultCache(60*60*24, md5(var_export($_POST, true))))
|
||||
$arResult['PAGE_CURRENT'] = $res->NavPageNomer;
|
||||
$arResult['PAGE_COUNT'] = $res->NavPageCount;
|
||||
|
||||
if($arResult['MODEL_DISABLED'])
|
||||
{
|
||||
$arResult['MODEL'] = null;
|
||||
$arResult['SELECTED']['MODEL'] = null;
|
||||
$arResult['SELECTED']['MODEL_ID'] = null;
|
||||
$arResult['SELECTED']['MODEL_UID'] = null;
|
||||
$arResult['SHOW_SPECIAL_OFFERS'] = false;
|
||||
}
|
||||
|
||||
if($arResult['BRAND_DISABLED'])
|
||||
{
|
||||
$arResult['BRAND'] = null;
|
||||
$arResult['SELECTED']['BRAND'] = null;
|
||||
$arResult['SELECTED']['BRAND_ID'] = null;
|
||||
$arResult['SELECTED']['BRAND_UID'] = null;
|
||||
$arResult['SHOW_SPECIAL_OFFERS'] = false;
|
||||
}
|
||||
|
||||
if(!is_null($arParams['REGION']))
|
||||
{
|
||||
if($arParams['REGION'] === "root")
|
||||
@ -614,6 +596,24 @@ if($this->StartResultCache(60*60*24, md5(var_export($_POST, true))))
|
||||
}
|
||||
}
|
||||
|
||||
if($arResult['MODEL_DISABLED'])
|
||||
{
|
||||
$arResult['MODEL'] = null;
|
||||
$arResult['SELECTED']['MODEL'] = null;
|
||||
$arResult['SELECTED']['MODEL_ID'] = null;
|
||||
$arResult['SELECTED']['MODEL_UID'] = null;
|
||||
$arResult['SHOW_SPECIAL_OFFERS'] = false;
|
||||
}
|
||||
|
||||
if($arResult['BRAND_DISABLED'])
|
||||
{
|
||||
$arResult['BRAND'] = null;
|
||||
$arResult['SELECTED']['BRAND'] = null;
|
||||
$arResult['SELECTED']['BRAND_ID'] = null;
|
||||
$arResult['SELECTED']['BRAND_UID'] = null;
|
||||
$arResult['SHOW_SPECIAL_OFFERS'] = false;
|
||||
}
|
||||
|
||||
foreach($breadcrumbs AS $breadcrumb)
|
||||
{
|
||||
$APPLICATION->AddChainItem($breadcrumb['NAME'], $breadcrumb['URL']);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user