Source
<?php declare(strict_types = 0);
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
/**
* @var CView $this
* @var array $data
*/
$form_action = (new CUrl('zabbix.php'))
->setArgument('action', 'mfa.check')
->getUrl();
$form = (new CForm('post', $form_action))
->addItem(getMessages());
if (array_key_exists('mfaid', $data)) {
$form->addVar('mfaid', $data['mfaid']);
}
if (array_key_exists('add_mfa_method', $data)) {
$form->addVar('add_mfa_method', $data['add_mfa_method']);
}
// Enable form submitting on Enter.
$form->addItem((new CSubmitButton())->addClass(ZBX_STYLE_FORM_SUBMIT_HIDDEN));
$curl_warning = $data['curl_error']
? (makeWarningIcon(
_('You are not able to choose some of the MFA methods, because PHP CURL extension is not installed on the web server.')
))
: '';
$form
->addItem((new CFormGrid())
->addItem([
new CLabel(_('Type'), 'type'),
new CFormField([
(new CSelect('type'))
->setFocusableElementId('type')
->setValue($data['type'])
->addOption(new CSelectOption(MFA_TYPE_TOTP, _('TOTP')))
->addOption((new CSelectOption(MFA_TYPE_DUO, _('Duo Universal Prompt')))
->setDisabled($data['curl_error'])),
$curl_warning
])
])
->addItem([
(new CLabel([
_('Name'),
makeHelpIcon(_('Shown as the label to all MFA users in authenticator apps.'))
], 'name'))->setAsteriskMark(),