public function resetPasswordAction() { $code = $this->dispatcher->getParam("code"); $resetPassword = ResetPasswords::findFirstByCode($code); if (!$resetPassword) { return $this->dispatcher->formward(array('controller' => 'index', 'action' => 'index')); } if ($resetPassword->reset != 'N') { return $this->dispatcher->forward(array('controller' => 'session', 'action' => 'login')); } $resetPassword->reset = 'Y'; if (!$resetPassword->save()) { foreach ($resetPassword->getMessages() as $message) { $this->flash->error($message); } return $this->dispatcher->forward(array('controller' => 'index', 'action' => 'index')); } $this->auth->authUserById($resetPassword->usersId); $this->flash->success('Please reset your password'); return $this->dispatcher->forward(array('controller' => 'users', 'action' => 'changePassword')); }