icingaweb2/application/forms/Authentication/Cancel2FAForm.php
2025-08-12 00:57:11 +02:00

45 lines
946 B
PHP

<?php
namespace Icinga\Forms\Authentication;
use Icinga\Web\Form;
use Icinga\Web\Session;
use Icinga\Web\Url;
class Cancel2FAForm extends Form
{
public function init()
{
$this->setRequiredCue(null);
$this->setName('form_cancel_2fa');
$this->setSubmitLabel($this->translate('Cancel'));
$this->setProgressLabel($this->translate('Canceling'));
$this->setAttrib('class', 'content-centered');
}
public function createElements(array $formData)
{
$this->addElement(
'hidden',
'redirect',
[
'value' => Url::fromRequest()->getParam('redirect')
]
);
$this->addElement(
'hidden',
'cancel_2fa',
[
'value' => true
]
);
}
public function onSuccess()
{
Session::getSession()->purge();
return true;
}
}