* * @author Benoit Chesneau */ public function show() { global $conf; global $INPUT; $token = preg_replace('/[^a-f0-9]+/', '', $INPUT->str('pwauth')); // print intro echo p_locale_xhtml('resetpwd'); echo '
'; if (!$conf['autopasswd'] && $token) { $form = $this->formSetNewPassword($token); } else { $form = $this->formResendPassword(); } echo $form->toHTML('ResendPwd'); echo '
'; } /** * create a form ui to set new password * * @params string $token cleaned pwauth request variable * @return Form */ protected function formSetNewPassword($token) { global $lang; // create the form $form = new Form(['id' => 'dw__resendpwd']); $form->addTagOpen('div')->addClass('no'); $form->addFieldsetOpen($lang['btn_resendpwd']); $form->setHiddenField('token', $token); $form->setHiddenField('do', 'resendpwd'); $input = $form->addPasswordInput('pass', $lang['pass'])->attr('size', '50')->addClass('edit'); $input->getLabel()->attr('class', 'block'); $form->addHTML("
\n"); $input = $form->addPasswordInput('passchk', $lang['passchk'])->attr('size', '50')->addClass('edit'); $input->getLabel()->attr('class', 'block'); $form->addHTML("
\n"); $form->addButton('', $lang['btn_resendpwd'])->attr('type', 'submit'); $form->addFieldsetClose(); $form->addTagClose('div'); return $form; } /** * create a form ui to request new password * * @return Form */ protected function formResendPassword() { global $lang; // create the form $form = new Form(['id' => 'dw__resendpwd']); $form->addTagOpen('div')->addClass('no'); $form->addFieldsetOpen($lang['btn_resendpwd']); $form->setHiddenField('do', 'resendpwd'); $form->setHiddenField('save', '1'); $form->addHTML("
\n"); $input = $form->addTextInput('login', $lang['user'])->addClass('edit'); $input->getLabel()->attr('class', 'block'); $form->addHTML("
\n"); $form->addHTML("
\n"); $form->addButton('', $lang['btn_resendpwd'])->attr('type', 'submit'); $form->addFieldsetClose(); $form->addTagClose('div'); return $form; } }