From 8e8d30990bc27870ca43fc93d06cfabd53e3c774 Mon Sep 17 00:00:00 2001 From: Johannes Rauh Date: Mon, 18 May 2026 11:39:17 +0200 Subject: [PATCH] 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. --- application/forms/Account/TwoFactorEnrollmentForm.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/application/forms/Account/TwoFactorEnrollmentForm.php b/application/forms/Account/TwoFactorEnrollmentForm.php index 66b30e4c4..7336751fc 100644 --- a/application/forms/Account/TwoFactorEnrollmentForm.php +++ b/application/forms/Account/TwoFactorEnrollmentForm.php @@ -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);