Form: Create CSRFTokens in way that ensures id uniqueness

This commit is contained in:
Johannes Meyer 2022-02-04 17:20:48 +01:00
parent 974bff9227
commit 7f0ddd931c
2 changed files with 2 additions and 2 deletions

View File

@ -1085,7 +1085,7 @@ class Form extends Zend_Form
return $this; return $this;
} }
if ($this->getElement($this->tokenElementName) === null) { if ($this->getElement($this->tokenElementName) === null) {
$this->addElement(new CsrfCounterMeasure($this->tokenElementName)); $this->addElement('CsrfCounterMeasure', $this->tokenElementName);
} }
} }
return $this; return $this;

View File

@ -40,7 +40,7 @@ class CsrfCounterMeasure extends FormElement
*/ */
public function init() public function init()
{ {
$this->addDecorator('ViewHelper'); $this->setDecorators(['ViewHelper']);
$this->setValue($this->generateCsrfToken()); $this->setValue($this->generateCsrfToken());
} }