publicCache(); } public function getContent() { return '
Hello world
'; } public function showform() { // Form should be set to private due to CSRF SecurityToken::enable(); return $this->renderWith('BlankPage'); } public function showpublicform() { // Public form doesn't use CSRF and thus no session usage SecurityToken::disable(); return $this->renderWith('BlankPage'); } /** * @return string * @throws \SilverStripe\Control\HTTPResponse_Exception */ public function privateaction() { if (!Permission::check('ANYCODE')) { $this->httpError(403, 'Not allowed'); } return 'ok'; } public function publicaction() { return 'Hello!'; } public function Form() { $form = new Form( $this, 'Form', new FieldList(new TextField('Name')), new FieldList(new FormAction('submit', 'Submit')) ); $form->setFormMethod('GET'); return $form; } }