MINOR: Removed use of deprecated securityTokenEnable.

This commit is contained in:
Sam Minnee 2011-10-29 17:10:02 +13:00
parent 42b8d3da04
commit b0b5fea3f5
2 changed files with 5 additions and 3 deletions

View File

@ -334,7 +334,9 @@ class FormField extends RequestHandler {
* @return bool
*/
public function securityTokenEnabled() {
return $this->getForm() && $this->getForm()->securityTokenEnabled();
$form = $this->getForm();
if(!$form) return false;
return $form->getSecurityToken()->isEnabled();
}
/**

View File

@ -1177,7 +1177,7 @@ JS
$parentUrlParts = parse_url(parent::Link($action));
$queryPart = (isset($parentUrlParts['query'])) ? '?' . $parentUrlParts['query'] : null;
// Ensure that URL actions not routed through Form->httpSubmission() are protected against CSRF attacks.
if($form->securityTokenEnabled()) $queryPart = $token->addtoUrl($queryPart);
if($token->isEnabled()) $queryPart = $token->addtoUrl($queryPart);
return Controller::join_links($parentUrlParts['path'], $queryPart);
} else {
// allow for instanciation of this FormField outside of a controller/form
@ -1416,7 +1416,7 @@ class TableListField_Item extends ViewableData {
$parentUrlParts = parse_url($this->parent->Link());
$queryPart = (isset($parentUrlParts['query'])) ? '?' . $parentUrlParts['query'] : null;
// Ensure that URL actions not routed through Form->httpSubmission() are protected against CSRF attacks.
if($form->securityTokenEnabled()) $queryPart = $token->addtoUrl($queryPart);
if($token->isEnabled()) $queryPart = $token->addtoUrl($queryPart);
return Controller::join_links($parentUrlParts['path'], 'item', $this->item->ID, $action, $queryPart);
} else {
// allow for instanciation of this FormField outside of a controller/form