From eef0f84ec347fe4f0507e8282e9f8d0cafeb1964 Mon Sep 17 00:00:00 2001 From: iglocska Date: Thu, 7 Sep 2017 15:30:10 +0200 Subject: [PATCH] fix: Added better debugging to the password shell --- app/Console/Command/PasswordShell.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Console/Command/PasswordShell.php b/app/Console/Command/PasswordShell.php index 94e9a1344..b4b3b77f9 100644 --- a/app/Console/Command/PasswordShell.php +++ b/app/Console/Command/PasswordShell.php @@ -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;