2use \Bitrix\Security\Mfa\Otp;
21 if (!isset(static::$cacheOtp[
$userId]))
26 return static::$cacheOtp[
$userId];
37 && preg_match(
'/(\d{6})$/D',
$arParams[
"PASSWORD"], $arMatch)
62 ||
$USER->CanDoOperation(
'security_edit_user_otp')
69 &&
$otp->isActivated()
82 &&
$otp->isActivated()
93 $secret = mb_substr(trim(
$arFields[
'SECRET']), 0, 64);
104 if (
$otp->getHexSecret() != $secret)
107 $binarySecret = pack(
'H*', $secret);
108 $otp->regenerate($binarySecret);
118 if ($sync1 || $sync2)
120 $otp->syncParameters($sync1, $sync2);
133 'id' =>
'security_otp',
134 'text' => $e->getMessage()
165 $event[
"TO_MODULE_ID"] ==
"security"
166 &&
$event[
"TO_CLASS"] ==
"CSecurityUser"
181 $otpRecheckAgent =
'Bitrix\Security\Mfa\OtpEvents::onRecheckDeactivate();';
188 CAgent::RemoveAgent($otpRecheckAgent,
"security");
190 "NAME" => $otpRecheckAgent,
191 "MODULE_ID" =>
"security",
193 "AGENT_INTERVAL" => 3600,
196 COption::SetOptionString(
'security',
'otp_enabled',
'Y');
205 CAgent::RemoveAgent($otpRecheckAgent,
"security");
206 COption::SetOptionString(
'security',
'otp_enabled',
'N');
216 $APPLICATION->set_cookie(Otp::SKIP_COOKIE,
'',
false,
'/',
false,
false,
true,
false,
true);
219 Otp::setDeferredParams(
null);
224 $isOtpMandatory = Otp::isMandatoryUsing();
225 return ($isOtpMandatory ?
true :
false);
234 return (
$otp->isActivated() ?
true :
false);
242 if (!static::IsOtpMandatory())
246 return $otp->canSkipMandatoryByRights();
255 return (
$otp->isInitialized() ?
true :
false);
268 ||
$USER->CanDoOperation(
'security_edit_user_otp')
274 $otp->deactivate($days);
299 &&
$USER->CanDoOperation(
'security_edit_user_otp')
328 ||
$USER->CanDoOperation(
'security_edit_user_otp')
356 ||
$USER->CanDoOperation(
'security_edit_user_otp')
360 return $otp->getDeactivateUntil();
375 if (
$otp->isActivated())
377 $datetime =
$otp->getInitialDate();
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
static DeferUserOtp($userId, $days=0)
static DeactivateUserOtp($userId, $days=0)
static OnAfterUserLogout()
const BX_SECURITY_SYNC_WINDOW
static setActive($pActive=false)
static IsUserSkipMandatoryRights($userId)
static IsUserOtpActive($userId)
static GetInitialDate($userId)
static onUserDelete($userId)
static IsUserOtpExist($userId)
static onBeforeUserLogin(&$arParams)
static getCachedOtp($userId)
static GetDeactivateUntil($userId)
static ActivateUserOtp($userId)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
RegisterModuleDependences($FROM_MODULE_ID, $MESSAGE_ID, $TO_MODULE_ID, $TO_CLASS="", $TO_METHOD="", $SORT=100, $TO_PATH="", $TO_METHOD_ARG=[])
UnRegisterModuleDependences($FROM_MODULE_ID, $MESSAGE_ID, $TO_MODULE_ID, $TO_CLASS="", $TO_METHOD="", $TO_PATH="", $TO_METHOD_ARG=[])
GetModuleEvents($MODULE_ID, $MESSAGE_ID, $bReturnArray=false)