fix: Added better debugging to the password shell

pull/2469/head
iglocska 2017-09-07 15:30:10 +02:00
parent ef9b9ba188
commit eef0f84ec3
1 changed files with 5 additions and 1 deletions

View File

@ -14,12 +14,16 @@ class PasswordShell extends AppShell {
else {
// get the users that need their password hashed
$results = $this->User->find('first', array('conditions' => array('email' => $this->args[0]), 'recursive' => -1));
if (empty($results)) {
echo 'User not found. Make sure you use the correct syntax: /var/www/MISP/app/Console/cake Password [email] [password]' . PHP_EOL;
exit;
}
$results['User']['password'] = $this->args[1];
$results['User']['confirm_password'] = $this->args[1];
$results['User']['change_pw'] = 1;
if (!$this->User->save($results)) {
echo 'Could not update account for User.id = ', $results['User']['id'], PHP_EOL;
debug($this->User->validationErrors);
echo json_encode($this->User->validationErrors) . PHP_EOL;
$this->out(print_r($this->User->invalidFields(), true));
}
echo 'Updated ', PHP_EOL;