diff --git a/app/Controller/AppController.php b/app/Controller/AppController.php index 830f0fd18..db1255b95 100644 --- a/app/Controller/AppController.php +++ b/app/Controller/AppController.php @@ -122,6 +122,12 @@ public function beforeFilter() { // XXX CO-351 Placeholder $this->Session->write('Config.language', 'eng'); + // CSRF token should expire along with the Session. This is the default in CAKEPHP 3.7.x+ + // https://book.cakephp.org/3/en/controllers/middleware.html#csrf-middleware + // https://github.com/cakephp/cakephp/issues/13532 + // - expiry, How long the CSRF token should last. Defaults to browser session. + $this->Security->csrfUseOnce = false; + Configure::write('Config.language', $this->Session->read('Config.language')); // Tell the Auth module to call the controller's isAuthorized() function. diff --git a/app/Controller/CoPeopleController.php b/app/Controller/CoPeopleController.php index 92f3e7cf7..d02db0029 100644 --- a/app/Controller/CoPeopleController.php +++ b/app/Controller/CoPeopleController.php @@ -252,6 +252,7 @@ public function canvas($id) { // This is pretty similar to the standard view or edit methods. if(!$this->request->is('restful') && $this->request->is('get')) { + $this->set('vv_title_status_bg', true); $this->edit($id); } } diff --git a/app/Controller/StandardController.php b/app/Controller/StandardController.php index b59c2e558..a96808014 100644 --- a/app/Controller/StandardController.php +++ b/app/Controller/StandardController.php @@ -538,7 +538,15 @@ function edit($id) { return; } - + + // Complete the request with the `status` field if it is of type PUT + // Usefull for asychronous single-field Requests + if($req === 'CoPerson' + && empty($this->request->data[$req]["status"]) + && !empty($curdata[$req]["status"])) { + $this->request->data[$req]["status"] = $curdata[$req]["status"]; + } + $data = $this->request->data; if(!isset($this->request->data[$req]['id'])) { @@ -633,6 +641,14 @@ function edit($id) { if($this->request->is('restful')) { $this->Api->restResultHeader(200, "OK"); + } elseif ($this->request->is('ajax')) { + // Return the new data + $this->layout = null; + $this->autoRender = false; + $this->response->type('json'); + $this->response->statusCode(201); + $this->response->body(json_encode(array(0 => $data))); + return $this->response; } else { // Redirect to index view diff --git a/app/Lib/lang.php b/app/Lib/lang.php index db70420bd..8f5c734e9 100644 --- a/app/Lib/lang.php +++ b/app/Lib/lang.php @@ -1897,6 +1897,7 @@ 'js.auth.reset' => 'Please confirm resetting \x22{0}\x22 for {1}.', 'js.auth.unlock' => 'Please confirm unlocking \x22{0}\x22 for {1}.', 'js.ois.inventory' => 'Are you sure you wish to retrieve the full inventory from this backend? This may be slow and result in a large page load.', + 'js.reload' => 'Please Reload!', 'js.remove' => 'Are you sure you wish to remove \x22{0}\x22? This action cannot be undone.', 'js.remove.id.prov' => 'The identifier \x22{0}\x22 was created by the provisioning target, and removing it may cause operational problems. Are you sure you wish to remove it? This action cannot be undone.', 'js.remove.member' => 'Are you sure you wish to remove this member from group \x22{0}\x22? This action cannot be undone.', diff --git a/app/View/CoPeople/fields.inc b/app/View/CoPeople/fields.inc index ec1aa9add..7701a8bfb 100644 --- a/app/View/CoPeople/fields.inc +++ b/app/View/CoPeople/fields.inc @@ -342,6 +342,10 @@