public function createNewAction() { if ($this->_hasParam('id') && $this->_hasParam('key')) { $userDomain = new \User_Domain_User(); $user = $userDomain->getById($this->_getParam('id')); if ($user) { if ($userDomain->isValidResetPasswordKey($user, $this->_getParam('key'))) { $form = new \User_Form_Password(User_Form_Password::ACTION_EDIT, $user); $this->view->form = $form; $request = $this->getRequest(); if ($request->isPost()) { $data = $request->getPost(); $form->populate($data); if ($form->save->isChecked()) { if ($form->isValid($data)) { try { $this->updatePassword($data); $msg = 'Password updated, please login'; $this->_helper->flashMessenger->addMessage(array('success' => $msg)); $this->_helper->redirector('index', 'auth', 'user'); } catch (Exception $e) { $this->addSavingExceptionMessage($e); } } else { $this->_helper->flashMessenger->addMessage(array('validation' => 'Some problem with fields content.')); } } else { $this->_helper->redirector('index', 'auth', 'user'); } } } else { $this->redirectInvalidResetLink(); } } else { // if not $user $this->redirectInvalidResetLink(); } } else { // if has param ID $msg = 'Param "id" or "key" is missing'; $this->_helper->flashMessenger->addMessage(array('error' => $msg)); $this->_helper->redirector('index', 'reset-password', 'user'); } }