/** * @return \Phalcon\Http\ResponseInterface */ public function resetpasswordAction() { if ($this->session->has('auth')) { $this->view->disable(); return $this->response->redirect(); } $passwordForgotHash = $this->request->getQuery('forgothash'); if (empty($passwordForgotHash)) { $this->flashSession->error('Hack attempt!!!'); return $this->response->redirect(); } $object = Users::findFirstByPasswdForgotHash($passwordForgotHash); if (!$object) { $this->flashSession->error(t('Invalid data.')); return $this->response->redirect(); } $form = new ResetPasswordForm(); $this->view->form = $form; if ($this->request->isPost()) { if (!$form->isValid($_POST)) { foreach ($form->getMessages() as $message) { $this->flashSession->error($message); } } else { $object->setPasswd($this->security->hash($this->request->getPost('password_new_confirm'))); $object->setPasswdForgotHash(null); if (!$object->save()) { $this->displayModelErrors($object); } else { $this->flashSession->success(t('Your password was changed successfully.')); return $this->response->redirect(); } } } }