/** * The public newpassword action - display newpassword form and set a new password * * @return void */ public function newpasswordAction() { $newPasswordForm = new User_Form(); $newPasswordForm->setAction($this->baseUrl . '/' . Digitalus_Toolbox_Page::getCurrentPageName() . '/p/a/newpassword'); $newPasswordForm->getElement('name')->addValidators(array(array('UsernameExists', true))); $newPasswordForm->getElement('email')->addValidators(array(array('UserEmailExists', true))); $newPasswordForm->onlyNewpasswordActionElements(array('legend' => 'New password')); // show form if unsent or invalid if ($this->_request->isPost() && $newPasswordForm->isValid($_POST)) { $userName = Digitalus_Filter_Post::get('name'); $email = Digitalus_Filter_Post::get('email'); $this->view->userName = $userName; $this->view->email = $email; $mdlRegistration = new Login_Registration(); $mdlRegistration->prepareChallenge($userName, $email); if ($mdlRegistration->sendConfirmationMail($userName, $email, $this->moduleData->email, 'changepassword')) { $this->view->success = true; } } else { $this->view->form = $newPasswordForm; } }