Ejemplo n.º 1
0
        Bitrix\Security\Mfa\Otp::setDefaultType($_POST['otp_default_type']);
    }
    if (is_numeric($_POST['otp_mandatory_skip_days'])) {
        Bitrix\Security\Mfa\Otp::setSkipMandatoryDays($_POST['otp_mandatory_skip_days']);
    }
    Bitrix\Security\Mfa\Otp::setMandatoryUsing($_POST['otp_mandatory_using'] === 'Y');
    if (is_array($_POST['otp_mandatory_rights'])) {
        Bitrix\Security\Mfa\Otp::setMandatoryRights($_POST['otp_mandatory_rights']);
    }
    if ($_REQUEST["save"] != "" && $_GET["return_url"] != "") {
        LocalRedirect($_GET["return_url"]);
    } else {
        LocalRedirect("/bitrix/admin/security_otp.php?lang=" . LANGUAGE_ID . $returnUrl . "&" . $tabControl->ActiveTabParam());
    }
}
$availableTypes = \Bitrix\Security\Mfa\Otp::getAvailableTypes();
$availableTypesDescription = \Bitrix\Security\Mfa\Otp::getTypesDescription();
$defaultType = \Bitrix\Security\Mfa\Otp::getDefaultType();
$targetRights = \Bitrix\Security\Mfa\Otp::getMandatoryRights();
$access = new CAccess();
$targetRightsNames = $access->GetNames($targetRights);
CJSCore::Init(array('access'));
$APPLICATION->AddHeadScript('/bitrix/js/security/admin/page/otp.js');
$APPLICATION->SetTitle(GetMessage("SEC_OTP_NEW_TITLE"));
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
if (CSecurityUser::isActive()) {
    $messageType = "OK";
    $messageText = GetMessage("SEC_OTP_NEW_ON");
} else {
    $messageType = "ERROR";
    $messageText = GetMessage("SEC_OTP_NEW_OFF");
		<td><?php 
    echo GetMessage("SEC_OTP_NEW_ACCESS_DENIED");
    ?>
</td>
	</tr>
<?php 
    return;
}
if ($ID <= 0 || $USER->getID() != $ID && !$USER->CanDoOperation('security_edit_user_otp')) {
    return;
}
CJSCore::Init(array('qrcode', 'ajax', 'window'));
$APPLICATION->AddHeadScript('/bitrix/js/security/admin/page/user-edit.js');
$otp = Otp::getByUser($ID);
$deactivateUntil = $otp->getDeactivateUntil();
$availableTypes = Otp::getAvailableTypes();
$availableTypesDescription = \Bitrix\Security\Mfa\Otp::getTypesDescription();
$currentPage = $APPLICATION->GetCurPageParam(sprintf('%s_active_tab=%s', $tabControl->name, $tabControl->tabs[$tabControl->tabIndex]['DIV']), array(sprintf('%s_active_tab', $tabControl->name)));
$deactivateDays = array();
$deactivateDays[] = GetMessage("SEC_OTP_NO_DAYS");
for ($i = 1; $i <= 10; $i++) {
    $deactivateDays[$i] = FormatDate("ddiff", time() - 60 * 60 * 24 * $i);
}
$jsMessages = array('SEC_OTP_ERROR_TITLE' => GetMessage('SEC_OTP_ERROR_TITLE'), 'SEC_OTP_UNKNOWN_ERROR' => GetMessage('SEC_OTP_UNKNOWN_ERROR'));
$jsSettings = array('userId' => (int) $ID, 'successfulUrl' => $currentPage, 'deactivateDays' => $deactivateDays, 'availableTypes' => $availableTypesDescription);
?>
<script id="otp-user-edit-messages" type="application/json"><?php 
echo \Bitrix\Main\Web\Json::encode($jsMessages);
?>
</script>
<script id="otp-user-edit-settings" type="application/json"><?php