</td> </tr> <?php } ?> <?php } ?> <tr> <td style="text-align: left;"> <span><?php echo GetMessage('SEC_OTP_CONNECTED'); ?> </span> <?php if (!Otp::isMandatoryUsing() || $otp->canSkipMandatory() || $USER->CanDoOperation('security_edit_user_otp')) { ?> <span class="otp-link-button" id="otp-deactivate"><?php echo GetMessage('SEC_OTP_DISABLE'); ?> </span> <?php } ?> <?php if (Otp::isRecoveryCodesEnabled()) { ?> <span class="otp-link-button" id="otp-show-recovery-codes"><?php echo GetMessage('SEC_OTP_RECOVERY_CODES_BUTTON'); ?> </span>
"MESSAGE" => GetMessage('SEC_OTP_WARNING_RECOVERY_CODES'), "TYPE" => 'ERROR', "HTML" => true ));?> </td> </tr> <?endif;?> <?endif;?> <tr> <td style="text-align: left;"> <span><?php echo GetMessage('SEC_OTP_CONNECTED'); ?> </span> <?if( !Otp::isMandatoryUsing() || $otp->canSkipMandatory() || $USER->CanDoOperation('security_edit_user_otp') ):?> <span class="otp-link-button" id="otp-deactivate"><?php echo GetMessage('SEC_OTP_DISABLE'); ?> </span> <?endif;?> <?if (Otp::isRecoveryCodesEnabled()):?> <span class="otp-link-button" id="otp-show-recovery-codes"><?php echo GetMessage('SEC_OTP_RECOVERY_CODES_BUTTON'); ?> </span> <?endif;?> <?if ($USER->CanDoOperation('security_edit_user_otp')):?>
function deffer($userId, $days = 0) { /* @global CUser $USER */ global $USER; if ((Otp::isMandatoryUsing() || $userId != $USER->GetID()) && !$USER->CanDoOperation('security_edit_user_otp')) { return array('status' => 'error', 'error' => 'permissions check'); } try { $otp = Otp::getByUser($userId); $otp->defer($days); $result = array('status' => 'ok'); } catch (\Bitrix\Security\Mfa\OtpException $e) { $result = array('status' => 'error', 'error' => $e->getMessage()); } return $result; }
public static function IsOtpMandatory() { $isOtpMandatory = Otp::isMandatoryUsing(); return $isOtpMandatory ? true : false; }