lib: Disable CSRF token on HTTP authenticated users and not XHR
refs #9660
This commit is contained in:
parent
36ff2d8914
commit
db505281ee
|
@ -948,10 +948,18 @@ class Form extends Zend_Form
|
|||
*/
|
||||
public function addCsrfCounterMeasure()
|
||||
{
|
||||
if (! $this->tokenDisabled && $this->getElement($this->tokenElementName) === null) {
|
||||
$this->addElement(new CsrfCounterMeasure($this->tokenElementName));
|
||||
if (! $this->tokenDisabled) {
|
||||
$request = $this->getRequest();
|
||||
if (! $request->isXmlHttpRequest()
|
||||
&& ($user = $request->getUser()) !== null
|
||||
&& $user->getIsHttpUser()
|
||||
) {
|
||||
return $this;
|
||||
}
|
||||
if ($this->getElement($this->tokenElementName) === null) {
|
||||
$this->addElement(new CsrfCounterMeasure($this->tokenElementName));
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue