예제 #1
0
파일: otp.php 프로젝트: DarneoStudio/bitrix
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
$store_password = COption::GetOptionString('security', 'otp_allow_remember') === 'Y';
$bNeedCaptcha = CModule::IncludeModule("security") && \Bitrix\Security\Mfa\Otp::isCaptchaRequired();
?>

<div class="login-main-popup-wrap login-popup-wrap<?php 
echo $bNeedCaptcha ? " login-captcha-popup-wrap" : "";
?>
" id="otp">
	<input type="hidden" name="TYPE" value="OTP">
	<div class="login-popup">
		<div class="login-popup-title"><?php 
echo GetMessage('AUTH_TITLE');
?>
</div>
		<div class="login-popup-title-description"><?php 
echo GetMessage("AUTH_PLEASE_AUTH");
?>
</div>
		<div class="login-popup-field">
			<div class="login-popup-field-title"><?php 
echo GetMessage("AUTH_OTP_PASS");
?>
</div>
			<div class="login-input-wrap">
				<input type="text" class="login-input" onfocus="BX.addClass(this.parentNode, 'login-input-active')" onblur="BX.removeClass(this.parentNode, 'login-input-active')" name="USER_OTP" value="" tabindex="1" autocomplete="off">
				<div class="login-inp-border"></div>
예제 #2
0
 $url = urlencode($APPLICATION->GetCurPageParam("", array_merge($arParamsToDelete, array("backurl"))));
 $custom_reg_page = COption::GetOptionString('main', 'custom_register_page');
 $arResult["AUTH_REGISTER_URL"] = $custom_reg_page != '' ? $custom_reg_page : $arParams["REGISTER_URL"] . (strpos($arParams["REGISTER_URL"], "?") !== false ? "&" : "?") . "register=yes&backurl=" . $url;
 $arResult["AUTH_FORGOT_PASSWORD_URL"] = $arParams["FORGOT_PASSWORD_URL"] . (strpos($arParams["FORGOT_PASSWORD_URL"], "?") !== false ? "&" : "?") . "forgot_password=yes&backurl=" . $url;
 $arResult["AUTH_LOGIN_URL"] = $APPLICATION->GetCurPageParam("login_form=yes", $arParamsToDelete);
 $arRes = array();
 foreach ($arResult as $key => $value) {
     $arRes[$key] = htmlspecialcharsbx($value);
     $arRes['~' . $key] = $value;
 }
 $arResult = $arRes;
 if (CModule::IncludeModule("security") && Mfa\Otp::isOtpRequired() && $_REQUEST["login_form"] != "yes") {
     $arResult["FORM_TYPE"] = "otp";
     $arResult["REMEMBER_OTP"] = COption::GetOptionString('security', 'otp_allow_remember') === 'Y';
     $arResult["CAPTCHA_CODE"] = false;
     if (Mfa\Otp::isCaptchaRequired()) {
         $arResult["CAPTCHA_CODE"] = $APPLICATION->CaptchaGetCode();
     }
     if (Mfa\Otp::isOtpRequiredByMandatory()) {
         $arResult['ERROR_MESSAGE'] = array("MESSAGE" => GetMessage("system_auth_form_otp_required"), "TYPE" => "ERROR");
     }
 } else {
     $arResult["FORM_TYPE"] = "login";
     $arVarExcl = array("USER_LOGIN" => 1, "USER_PASSWORD" => 1, "backurl" => 1, "auth_service_id" => 1);
     $arResult["GET"] = array();
     $arResult["POST"] = array();
     foreach ($_POST as $vname => $vvalue) {
         if (!array_key_exists($vname, $arVarExcl)) {
             if (!is_array($vvalue)) {
                 $arResult["POST"][htmlspecialcharsbx($vname)] = htmlspecialcharsbx($vvalue);
             } else {
예제 #3
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
if (!is_array($arAuthResult)) {
    $arAuthResult = array("TYPE" => "ERROR", "MESSAGE" => $arAuthResult);
}
if ($inc_file === "otp") {
    $arAuthResult['CAPTCHA'] = CModule::IncludeModule("security") && \Bitrix\Security\Mfa\Otp::isCaptchaRequired();
} else {
    $arAuthResult['CAPTCHA'] = $APPLICATION->NeedCAPTHAForLogin($last_login);
}
if ($arAuthResult['CAPTCHA']) {
    $arAuthResult['CAPTCHA_CODE'] = $APPLICATION->CaptchaGetCode();
}
if ($bOnHit) {
    ?>
<script type="text/javascript">
BX.ready(function(){BX.defer(BX.adminLogin.setAuthResult, BX.adminLogin)(<?php 
    echo CUtil::PhpToJsObject($arAuthResult);
    ?>
);});
</script>
<?php 
} else {
    ?>
<script type="text/javascript" bxrunfirst="true">
top.BX.adminLogin.setAuthResult(<?php 
    echo CUtil::PhpToJsObject($arAuthResult);
    ?>