- Модуль: main
- Путь к файлу: ~/bitrix/modules/main/classes/general/main.php
- Класс: CAllMain
- Вызов: CAllMain::AuthForm
public function AuthForm($mess, $show_prolog=true, $show_epilog=true, $not_show_links="N", $do_die=true)
{
$excl = array("excl"=>1, "key"=>1, "GLOBALS"=>1, "mess"=>1, "show_prolog"=>1, "show_epilog"=>1, "not_show_links"=>1, "do_die"=>1);
foreach($GLOBALS as $key => $value)
if(!array_key_exists($key , $excl))
global ${$key};
if(mb_substr($this->GetCurDir(), 0, mb_strlen(BX_ROOT."/admin/")) == BX_ROOT."/admin/" || (defined("ADMIN_SECTION") && ADMIN_SECTION===true))
$isAdmin = "_admin";
else
$isAdmin = "";
if(isset($this->arAuthResult) && $this->arAuthResult !== true && (is_array($this->arAuthResult) || $this->arAuthResult <> ''))
$arAuthResult = $this->arAuthResult;
else
$arAuthResult = $mess;
/** @global CMain $APPLICATION */
global $APPLICATION, $forgot_password, $change_password, $register, $confirm_registration;
//page title
$APPLICATION->SetTitle(GetMessage("AUTH_TITLE"));
if (
is_array($arAuthResult)
&& isset($arAuthResult["TYPE"])
&& isset($arAuthResult["ERROR_TYPE"])
&& $arAuthResult["TYPE"] === "ERROR"
&& $arAuthResult["ERROR_TYPE"] === "CHANGE_PASSWORD"
)
{
//require to change the password after N days
$change_password = "yes";
}
$inc_file = "";
if($forgot_password=="yes")
{
//pass request form
$APPLICATION->SetTitle(GetMessage("AUTH_TITLE_SEND_PASSWORD"));
$comp_name = "system.auth.forgotpasswd";
$inc_file = "forgot_password";
}
elseif($change_password=="yes")
{
//pass change form
$APPLICATION->SetTitle(GetMessage("AUTH_TITLE_CHANGE_PASSWORD"));
$comp_name = "system.auth.changepasswd";
$inc_file = "change_password";
}
elseif($register=="yes" && $isAdmin=="" && COption::GetOptionString("main", "new_user_registration", "N")=="Y")
{
//registration form
$APPLICATION->SetTitle(GetMessage("AUTH_TITLE_REGISTER"));
$comp_name = "system.auth.registration";
}
elseif(($confirm_registration === "yes") && ($isAdmin === "") && (COption::GetOptionString("main", "new_user_registration_email_confirmation", "N") === "Y"))
{
//confirm registartion
$APPLICATION->SetTitle(GetMessage("AUTH_TITLE_CONFIRM"));
$comp_name = "system.auth.confirmation";
}
elseif(
CModule::IncludeModule("security")
&& BitrixSecurityMfaOtp::isOtpRequired()
&& (!isset($_REQUEST["login_form"]) || $_REQUEST["login_form"] !== "yes")
)
{
//otp form
$APPLICATION->SetTitle(GetMessage("AUTH_TITLE_OTP"));
$comp_name = "system.auth.otp";
$inc_file = "otp";
}
else
{
header('X-Bitrix-Ajax-Status: Authorize');
//auth form
$comp_name = "system.auth.authorize";
$inc_file = "authorize";
}
if($show_prolog)
{
CMain::PrologActions();
define("BX_AUTH_FORM", true);
include($_SERVER["DOCUMENT_ROOT"].BX_ROOT."/modules/main/include/prolog".$isAdmin. "_after.php");
}
if($isAdmin == "")
{
// form by Components 2.0
$this->IncludeComponent(
"bitrix:".$comp_name,
COption::GetOptionString("main", "auth_components_template", ""),
array(
"AUTH_RESULT" => $arAuthResult,
"NOT_SHOW_LINKS" => $not_show_links,
)
);
}
else
{
include($_SERVER["DOCUMENT_ROOT"].BX_ROOT."/modules/main/interface/auth/wrapper.php");
}
$autoCompositeArea = MainCompositeInternalsAutomaticArea::getCurrentArea();
if ($autoCompositeArea)
{
$autoCompositeArea->end();
}
if($show_epilog)
{
include($_SERVER["DOCUMENT_ROOT"].BX_ROOT."/modules/main/include/epilog".$isAdmin.".php");
}
if($do_die)
{
die();
}
}