fix: [user] Allow password update and hiden confirm_password field

pull/37/head
mokaddem 2021-01-12 08:50:01 +01:00
parent 974d3197e8
commit 7029341e40
2 changed files with 5 additions and 4 deletions

View File

@ -196,9 +196,10 @@ class CRUDComponent extends Component
} }
} }
if (!empty($params['removeEmpty'])) { if (!empty($params['removeEmpty'])) {
foreach ($params['removeEmpty'] as $removeEmptyField) foreach ($params['removeEmpty'] as $removeEmptyField) {
if (isset($input[$removeEmptyField])) { if (empty($input[$removeEmptyField])) {
unset($input[$removeEmptyField]); unset($input[$removeEmptyField]);
}
} }
} }
return $input; return $input;

View File

@ -8,7 +8,7 @@ use Authentication\PasswordHasher\DefaultPasswordHasher;
class User extends AppModel class User extends AppModel
{ {
protected $_hidden = ['password']; protected $_hidden = ['password', 'confirm_password'];
protected function _setPassword(string $password) : ?string protected function _setPassword(string $password) : ?string
{ {
if (strlen($password) > 0) { if (strlen($password) > 0) {