• Модуль: security
  • Путь к файлу: ~/bitrix/modules/security/lib/mfa/otp.php
  • Класс: BitrixSecurityMfaOtp
  • Вызов: Otp::sendEvent
static function sendEvent(Otp $otp)
{
	$code = null;
	$algo = $otp->getAlgorithm();

	//code value only for TOTP
	if($algo instanceof BitrixMainSecurityMfaTotpAlgorithm)
	{
		//value based on the current time
		$timeCode = $algo->timecode(time());
		$code = $algo->generateOTP($timeCode);
	}

	$eventParams = [
		"userId" => $otp->getUserId(),
		"code" => $code,
	];

	$event = new BitrixMainEvent("security", "onOtpRequired", $eventParams);
	$event->send();
}