form/csrf: Set the csrf element decorators in the element not in the form
This commit is contained in:
parent
d10afa1f9b
commit
7eb51f6367
|
@ -480,9 +480,7 @@ class Form extends Zend_Form
|
||||||
public function addCsrfCounterMeasure()
|
public function addCsrfCounterMeasure()
|
||||||
{
|
{
|
||||||
if (false === $this->tokenDisabled && $this->getElement($this->tokenElementName) === null) {
|
if (false === $this->tokenDisabled && $this->getElement($this->tokenElementName) === null) {
|
||||||
$element = new CsrfCounterMeasure($this->tokenElementName);
|
$this->addElement(new CsrfCounterMeasure($this->tokenElementName));
|
||||||
$element->setDecorators(array('ViewHelper'));
|
|
||||||
$this->addElement($element);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
|
|
@ -29,6 +29,7 @@ class CsrfCounterMeasure extends Zend_Form_Element_Xhtml
|
||||||
{
|
{
|
||||||
$this->setRequired(true); // Not requiring this element would not make any sense
|
$this->setRequired(true); // Not requiring this element would not make any sense
|
||||||
$this->setIgnore(true); // We do not want this element's value being retrieved by Form::getValues()
|
$this->setIgnore(true); // We do not want this element's value being retrieved by Form::getValues()
|
||||||
|
$this->setDecorators(array('ViewHelper'));
|
||||||
$this->setValue($this->generateCsrfToken());
|
$this->setValue($this->generateCsrfToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue