@@ 23-30 (lines=8) @@ | ||
20 | $this->Security->requireAjax($actions); |
|
21 | $this->Security->requirePost($actions); |
|
22 | ||
23 | switch($action){ |
|
24 | case "create": |
|
25 | $this->Security->config("form", [ 'fields' => ['file']]); |
|
26 | break; |
|
27 | case "delete": |
|
28 | $this->Security->config("form", [ 'fields' => ['file_id']]); |
|
29 | break; |
|
30 | } |
|
31 | } |
|
32 | ||
33 | public function index(){ |
@@ 25-35 (lines=11) @@ | ||
22 | $this->Security->requirePost(['create', 'delete']); |
|
23 | ||
24 | // define the expected form fields for every action if exist |
|
25 | switch($action){ |
|
26 | case "create": |
|
27 | // you can exclude form fields if you don't care if they were sent with form fields or not |
|
28 | $this->Security->config("form", [ 'fields' => ['content']]); |
|
29 | break; |
|
30 | case "delete": |
|
31 | // If you want to disable validation for form tampering |
|
32 | // $this->Security->config("validateForm", false); |
|
33 | $this->Security->config("form", [ 'fields' => ['todo_id']]); |
|
34 | break; |
|
35 | } |
|
36 | } |
|
37 | ||
38 | public function index(){ |