Browse Source

Add configuration for security debug in FormHelper

Alejandro Ibarra 10 years ago
parent
commit
135c1ee439
1 changed files with 5 additions and 2 deletions
  1. 5 2
      src/View/Helper/FormHelper.php

+ 5 - 2
src/View/Helper/FormHelper.php

@@ -524,6 +524,7 @@ class FormHelper extends Helper
     public function end(array $secureAttributes = [])
     {
         $out = '';
+
         if ($this->requestType !== 'get' &&
             !empty($this->request['_Token'])
         ) {
@@ -558,7 +559,9 @@ class FormHelper extends Helper
         if (empty($this->request['_Token'])) {
             return null;
         }
-
+        $debugSecurity = Hash::get($secureAttributes, 'debugSecurity') ?: Configure::read('debug');
+        unset($secureAttributes['debugSecurity']);
+        
         $tokenData = $this->_buildFieldToken(
             $this->_lastAction,
             $fields,
@@ -572,7 +575,7 @@ class FormHelper extends Helper
             'value' => $tokenData['unlocked'],
         ]);
         $out .= $this->hidden('_Token.unlocked', $tokenUnlocked);
-        if (Configure::read('debug')) {
+        if ($debugSecurity) {
             $tokenDebug = array_merge($secureAttributes, [
                 'value' => urlencode(json_encode([
                     $this->_lastAction,