From 6b52841521dab2d5f90f6f0426935bedf1215f19 Mon Sep 17 00:00:00 2001 From: noud Date: Wed, 5 Sep 2012 13:46:24 +0200 Subject: [PATCH] Login. small shell script to reset password. Used like: ./Console/cake password --- app/Console/Command/PasswordShell.php | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 app/Console/Command/PasswordShell.php diff --git a/app/Console/Command/PasswordShell.php b/app/Console/Command/PasswordShell.php new file mode 100644 index 000000000..fcd295a25 --- /dev/null +++ b/app/Console/Command/PasswordShell.php @@ -0,0 +1,32 @@ +User->findByEmail($this->args[0]); + //$this->out(print_r($results, true)); + App::import('Component','Auth'); + $this->Auth = new AuthComponent(new ComponentCollection()); + + $count = count($results); + + $results['User']['password'] = $this->args[1]; + $results['User']['confirm_password'] = $this->args[1]; + + if (!$this->User->save($results)) { + echo 'Could not update account for User.id = ', $results['User']['id'], PHP_EOL; + debug($this->User->validationErrors); + $this->out(print_r($this->User->invalidFields(), true)); + } + + echo 'Updated ', PHP_EOL; + exit; + } +} \ No newline at end of file