diff options
author | Florian Pritz <bluewind@xinu.at> | 2016-09-27 19:34:33 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2016-11-01 17:29:04 +0100 |
commit | c5bc384962b4ef74578d54dc682276e36357f40b (patch) | |
tree | d0f000066734ecf6e2a3ebc3a571b02107b67bdf /application | |
parent | 588cb99b96f90a0893a313812a0e49e92027fede (diff) |
c/MY_Controller: Extract CSRF protection code into method
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application')
-rw-r--r-- | application/core/MY_Controller.php | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/application/core/MY_Controller.php b/application/core/MY_Controller.php index cbb95aa33..afd8b5ef2 100644 --- a/application/core/MY_Controller.php +++ b/application/core/MY_Controller.php @@ -62,11 +62,7 @@ class MY_Controller extends CI_Controller { } if ($csrf_protection && !$this->input->is_cli_request()) { - // 2 functions for accessing config options, really? - $this->config->set_item('csrf_protection', true); - config_item("csrf_protection", true); - $this->security->__construct(); - $this->security->csrf_verify(); + $this->_setup_csrf_protection(); } if ($this->config->item("environment") == "development") { @@ -108,4 +104,12 @@ class MY_Controller extends CI_Controller { } } + private function _setup_csrf_protection() + { + // 2 functions for accessing config options, really? + $this->config->set_item('csrf_protection', true); + config_item("csrf_protection", true); + $this->security->__construct(); + $this->security->csrf_verify(); + } } |