Exemplo n.º 1
0
    $hotp_user_window = intval($_POST["window_size"]);
    if ($hotp_user_window <= 0) {
        $hotp_user_window = 10;
    }
    COption::SetOptionString("security", "hotp_user_window", $hotp_user_window);
    COption::SetOptionString("security", "otp_allow_remember", $_POST["otp_allow_remember"] === "Y" ? "Y" : "N");
    COption::SetOptionString("security", "otp_allow_recovery_codes", $_POST["otp_allow_recovery_codes"] === "Y" ? "Y" : "N");
    if ($_POST['otp_default_type']) {
        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');
Exemplo n.º 2
0
                    }
                }
                $arResult["tasks"] = array("SHOW" => false, "TITLE" => GetMessage("SONET_C39_TASKS_TITLE"));
                if (array_key_exists("tasks", $arResult["ActiveFeatures"]) && (CSocNetFeaturesPerms::CanPerformOperation($USER->GetID(), SONET_ENTITY_USER, $arResult["User"]["ID"], "tasks", "view", CSocNetUser::IsCurrentUserModuleAdmin()) || $APPLICATION->GetGroupRight("intranet") >= "W") && CModule::IncludeModule("intranet")) {
                    $arResult["tasks"]["SHOW"] = true;
                    if (StrLen($arResult["ActiveFeatures"]["tasks"]) > 0) {
                        $arResult["tasks"]["TITLE"] = $arResult["ActiveFeatures"]["tasks"];
                    }
                }
            }
        }
        if (array_key_exists("RatingMultiple", $arResult) && count($arResult["RatingMultiple"]) > 0) {
            foreach ($arParams["RATING_ID_ARR"] as $rating_id) {
                if (array_key_exists($rating_id, $arResult["RatingMultiple"])) {
                    $arResult["RatingMultiple"][$rating_id]["VALUE"] = $arResult["User"]["RATING_" . $rating_id . "_CURRENT_VALUE"];
                }
            }
        }
        //otp
        if (CModule::IncludeModule("security")) {
            $arResult["User"]["OTP"]["IS_MANDATORY"] = CSecurityUser::IsOtpMandatory();
            $arResult["User"]["OTP"]["IS_ACTIVE"] = CSecurityUser::IsUserOtpActive($arResult["User"]["ID"]);
            $arResult["User"]["OTP"]["IS_EXIST"] = CSecurityUser::IsUserOtpExist($arResult["User"]["ID"]);
            $arResult["User"]["OTP"]["ARE_RECOVERY_CODES_ENABLED"] = Bitrix\Security\Mfa\Otp::isRecoveryCodesEnabled();
            $dateDeactivate = CSecurityUser::GetDeactivateUntil($arResult["User"]["ID"]);
            $arResult["User"]["OTP"]["NUM_LEFT_DAYS"] = $dateDeactivate ? FormatDate("ddiff", time() - 60 * 60 * 24, MakeTimeStamp($dateDeactivate)) : "";
        }
    }
}
$this->IncludeComponentTemplate();
return array("NAME" => $arResult["User"]["NAME_FORMATTED"]);