-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix CSRF validation for sorting in property tables
- Loading branch information
Showing
3 changed files
with
72 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace Icinga\Module\Director\Web\Form; | ||
|
||
use ipl\Html\Form; | ||
use ipl\Html\ValidHtml; | ||
|
||
class PropertyTableSortForm extends Form | ||
{ | ||
/** @var string Name of the table using the form */ | ||
private $name; | ||
|
||
/** @var string Table to sort */ | ||
private $table; | ||
|
||
public function __construct(string $name, ValidHtml $table) | ||
{ | ||
$this->name = $name; | ||
$this->table = $table; | ||
} | ||
|
||
protected function assemble() | ||
{ | ||
$this->addElement('hidden', '__FORM_NAME', ['value' => $this->name]); | ||
$this->addElement('hidden', '__FORM_CSRF', ['value' => CsrfToken::generate()]); | ||
$this->addHtml($this->table); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters