Add module class to 2FA config fieldset in TwoFactorEnrollmentForm

The `icinga-module module-{name}` class pair lets the providing module scope
its CSS to its own fieldset without affecting other form elements.
This commit is contained in:
Johannes Rauh 2026-05-18 11:39:17 +02:00
parent 0adc5543a1
commit 8e8d30990b

View file

@ -5,12 +5,14 @@
namespace Icinga\Forms\Account;
use Icinga\Application\ClassLoader;
use Icinga\Application\Hook\TwoFactorHook;
use Icinga\Authentication\Auth;
use Icinga\Authentication\TwoFactor;
use Icinga\Web\Notification;
use Icinga\Web\RememberMe;
use Icinga\Web\Session;
use ipl\Html\Attributes;
use ipl\Html\FormElement\FieldsetElement;
use ipl\Web\Common\CsrfCounterMeasure;
use ipl\Web\Common\FormUid;
@ -72,7 +74,12 @@ class TwoFactorEnrollmentForm extends CompatForm
return;
}
$configFieldset = new FieldsetElement($twoFactor->getName());
$configFieldset = new FieldsetElement(
$twoFactor->getName(),
Attributes::create([
'class' => 'icinga-module module-' . ClassLoader::extractModuleName(get_class($twoFactor))
])
);
$this->addElement($configFieldset);
$twoFactor->assembleEnrollmentFormElements($configFieldset);