• Модуль: security
  • Путь к файлу: ~/bitrix/modules/security/lib/mfa/otp.php
  • Класс: BitrixSecurityMfaOtp
  • Вызов: Otp::syncParameters
public function syncParameters($inputA, $inputB = null)
{
	if (!$inputA)
		throw new OtpException(Loc::getMessage('SECURITY_OTP_ERROR_PASS1_EMPTY'));
	elseif (!preg_match('/^d{6}$/D', $inputA))
		throw new OtpException(getMessage('SECURITY_OTP_ERROR_PASS1_INVALID'));

	if ($this->getAlgorithm()->isTwoCodeRequired())
	{
		if (!$inputB)
			throw new OtpException(Loc::getMessage('SECURITY_OTP_ERROR_PASS2_EMPTY'));
		elseif (!preg_match('/^d{6}$/D', $inputB))
			throw new OtpException(Loc::getMessage('SECURITY_OTP_ERROR_PASS2_INVALID'));
	}

	try
	{
		$params = $this->getSyncParameters($inputA, $inputB);
	}
	catch (BitrixMainSecurityOtpException $e)
	{
		throw new OtpException(Loc::getMessage('SECURITY_OTP_ERROR_SYNC_ERROR'));
	}

	$this->setParams($params);

	return $this;
}