fix: [API] users/edit fixed

pull/5435/head
iglocska 2019-11-26 19:25:30 +01:00
parent dc1f9fcad9
commit 0c850c7cdb
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 4 additions and 2 deletions

View File

@ -151,7 +151,6 @@ class UsersController extends AppController
}
}
}
if (!$abortPost && !$this->_isRest()) {
if (Configure::read('Security.require_password_confirmation')) {
if (!empty($this->request->data['User']['current_password'])) {
@ -173,8 +172,11 @@ class UsersController extends AppController
if (!empty($this->request->data['User']['password'])) {
$fieldList[] = 'password';
}
foreach ($this->request->data['User'] as $k => $v) {
$currentUser['User'][$k] = $v;
}
// Save the data
if ($this->User->save($this->request->data, true, $fieldList)) {
if ($this->User->save($currentUser, true, $fieldList)) {
if ($this->_isRest()) {
$user = $this->User->find('first', array(
'conditions' => array('User.id' => $id),