Skip to content

Commit faa2b5f

Browse files
committed
Add CsrfCounterMeasure to TwoFactorConfigForm
1 parent 6ff42c8 commit faa2b5f

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

application/forms/Account/TwoFactorConfigForm.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
use Icinga\Web\Form\Element\FakeFormElement;
1111
use Icinga\Web\Form\Validator\TotpTokenValidator;
1212
use Icinga\Web\Notification;
13+
use Icinga\Web\Session;
1314
use ipl\Html\Attributes;
1415
use ipl\Html\HtmlElement;
1516
use ipl\Html\Text;
17+
use ipl\Web\Common\CsrfCounterMeasure;
1618
use ipl\Web\Common\FormUid;
1719
use ipl\Web\Compat\CompatForm;
1820
use ipl\Web\Url;
@@ -25,6 +27,7 @@
2527
*/
2628
class TwoFactorConfigForm extends CompatForm
2729
{
30+
use CsrfCounterMeasure;
2831
use Database;
2932
use FormUid;
3033

@@ -75,6 +78,7 @@ public function setTwoFactor(TwoFactorTotp $twoFactor): static
7578

7679
protected function assemble(): void
7780
{
81+
$this->addCsrfCounterMeasure(Session::getSession()->getId());
7882
$this->addElement($this->createUidElement());
7983

8084
if (TwoFactorTotp::hasDbSecret($this->getDb(), $this->user->getUsername())) {

0 commit comments

Comments
 (0)