/** * Forgot Password Confirm * */ protected function ResetPasswordConfirm() { $myWords = $this->WordCollection(); if (!$this->_login->getCanRetrievePassword()) { $this->FormLogin(); return; } elseif ($this->_login->getPassword() == "" || $this->_context->get('password2') == "") { $container = new XmlnukeUIAlert($this->_context, UIAlert::BoxAlert); $container->setAutoHide(5000); $container->addXmlnukeObject(new XmlnukeText($myWords->Value("PASSWORDISREQUIRED"), true)); $this->_blockCenter->addXmlnukeObject($container); $this->ResetPassword(); return; } elseif ($this->_login->getPassword() != $this->_context->get('password2')) { $container = new XmlnukeUIAlert($this->_context, UIAlert::BoxAlert); $container->setAutoHide(5000); $container->addXmlnukeObject(new XmlnukeText($myWords->Value("PASSWORDNOTMATCH"), true)); $this->_blockCenter->addXmlnukeObject($container); $this->ResetPassword(); return; } $user = $this->_users->getUserName($this->_login->getUsername()); $tokenValid = $user->getField("TOKEN_PWD_RESET") == $this->_login->getResetToken() && $user->getField("TOKEN_PWD_RESET_VALID") >= DateUtil::Today(DATEFORMAT::YMD); if (is_null($user) || !$tokenValid) { $this->FormLogin(); } elseif ($user->getField("TOKEN_PWD_RESET") != $this->_login->getResetToken()) { $container = new XmlnukeUIAlert($this->_context, UIAlert::BoxAlert); $container->setAutoHide(5000); $container->addXmlnukeObject(new XmlnukeText($myWords->Value("RESETINVALIDTOKEN"), true)); $this->_blockCenter->addXmlnukeObject($container); $this->FormLogin(); return; } else { $newpassword = $this->_users->getSHAPassword($this->_login->getPassword()); $user->setField('TOKEN_PWD_RESET', ''); $user->setField('TOKEN_PWD_RESET_VALID', ''); $user->setField($this->_users->getUserTable()->password, $newpassword); $this->_users->Save(); $container = new XmlnukeUIAlert($this->_context, UIAlert::ModalDialog, ""); $container->addRedirectButton($myWords->Value("TXT_BACK"), $this->_login->getReturnUrl()); $container->addXmlnukeObject(new XmlnukeText($myWords->Value("RESETPASSWORDOK"), true)); $this->_blockCenter->addXmlnukeObject($container); $this->FormLogin(); } }
protected function Opcao18() { $block = new XmlBlockCollection("Exemplo 18: UI Alert", BlockPosition::Center); //XmlnukeBreakLine br = new XmlnukeBreakLine(); $para = new XmlParagraphCollection(); $para->addXmlnukeObject(new XmlnukeText("Esse exemplo mostra como mostrar uma mensagem de alert no cliente")); $block->addXmlnukeObject($para); if ($this->_context->get("type") != "") { switch ($this->_context->get("type")) { case 1: $uialert = new XmlnukeUIAlert($this->_context, UIAlert::Dialog, "Isso é um teste"); break; case 2: $uialert = new XmlnukeUIAlert($this->_context, UIAlert::ModalDialog, "Isso é um teste"); $uialert->setAutoHide(10000); break; case 3: $uialert = new XmlnukeUIAlert($this->_context, UIAlert::ModalDialog, "Isso é um teste"); $uialert->addRedirectButton("Ok", $this->_url); $uialert->addCloseButton("Cancel"); break; case 4: $uialert = new XmlnukeUIAlert($this->_context, UIAlert::ModalDialog, "Isso é um teste"); $uialert->addRedirectButton("Ok, proceed!", $this->_url); $uialert->addCloseButton("Cancel"); $uialert->setOpenAction(UIAlertOpenAction::Button, "Clique me"); break; case 5: $uialert = new XmlnukeUIAlert($this->_context, UIAlert::BoxInfo, "Isso é um teste"); $uialert->setAutoHide(2000); break; case 6: $uialert = new XmlnukeUIAlert($this->_context, UIAlert::BoxAlert, "Isso é um teste"); break; } $uialert->addXmlnukeObject(new XmlnukeText("Isso é um novo teste, novo teste")); $block->addXmlnukeObject($uialert); } $list = array(); $list[$this->_url . "?op=18&type=1"] = "Caixa de Diálogo"; $list[$this->_url . "?op=18&type=2"] = "Caixa de Diálogo Modal"; $list[$this->_url . "?op=18&type=3"] = "Caixa de Diálogo Modal com botão de fechar"; $list[$this->_url . "?op=18&type=4"] = "Caixa de Diálogo Modal com botões de confirmação e abrir personalizado"; $list[$this->_url . "?op=18&type=5"] = "Box de Informação com auto hide"; $list[$this->_url . "?op=18&type=6"] = "Box de Alerta"; $listElement = new XmlListCollection(XmlListType::UnorderedList, "Opções"); foreach ($list as $key => $value) { $href = new XmlAnchorCollection($key); $href->addXmlnukeObject(new XmlnukeText($value)); $listElement->addXmlnukeObject($href); } $block->addXmlnukeObject($listElement); $this->_document->addXmlnukeObject($block); }