1<?php 2 3namespace dokuwiki\Ui; 4 5use dokuwiki\Extension\Event; 6use dokuwiki\Form\Form; 7 8/** 9 * DokuWiki Resend Password Request Insterface 10 * 11 * @package dokuwiki\Ui 12 */ 13class UserResendPwd extends Ui 14{ 15 /** 16 * Display the form to request a new password for an existing account 17 * 18 * @author Benoit Chesneau <benoit@bchesneau.info> 19 * @author Andreas Gohr <andi@splitbrain.org> 20 * 21 * @triggers HTML_RESENDPWDFORM_OUTPUT 22 * @return void 23 */ 24 public function show() 25 { 26 global $lang; 27 global $conf; 28 global $INPUT; 29 30 $token = preg_replace('/[^a-f0-9]+/', '', $INPUT->str('pwauth')); 31 32 // print intro 33 print p_locale_xhtml('resetpwd'); 34 print '<div class="centeralign">'.DOKU_LF; 35 36 if (!$conf['autopasswd'] && $token) { 37 // create the form 38 $form = new Form(['id' => 'dw__resendpwd']); 39 $form->addTagOpen('div')->addClass('no'); 40 $form->addFieldsetOpen($lang['btn_resendpwd']); 41 $form->setHiddenField('token', $token); 42 $form->setHiddenField('do', 'resendpwd'); 43 $input = $form->addPasswordInput('pass', $lang['pass'])->attr('size', '50')->addClass('edit'); 44 $input->getLabel()->attr('class', 'block'); 45 $form->addHTML("<br>\n"); 46 $input = $form->addPasswordInput('passchk', $lang['passchk'])->attr('size', '50')->addClass('edit'); 47 $input->getLabel()->attr('class', 'block'); 48 $form->addHTML("<br>\n"); 49 $form->addButton('', $lang['btn_resendpwd'])->attrs(['type' => 'submit']); 50 $form->addFieldsetClose(); 51 $form->addTagClose('div'); 52 } else { 53 // create the form 54 $form = new Form(['id' => 'dw__resendpwd']); 55 $form->addTagOpen('div')->addClass('no'); 56 $form->addFieldsetOpen($lang['btn_resendpwd']); 57 $form->setHiddenField('do', 'resendpwd'); 58 $form->setHiddenField('save', '1'); 59 $form->addHTML("<br>\n"); 60 $input = $form->addTextInput('login', $lang['user'])->addClass('edit') 61 ->val($INPUT->str('login')); 62 $input->getLabel()->attr('class', 'block'); 63 $form->addHTML("<br>\n"); 64 $form->addHTML("<br>\n"); 65 $form->addButton('', $lang['btn_resendpwd'])->attrs(['type' => 'submit']); 66 $form->addFieldsetClose(); 67 $form->addTagClose('div'); 68 } 69 70 // emit HTML_RESENDPWDFORM_OUTPUT event, print the form 71 Event::createAndTrigger('HTML_RESENDPWDFORM_OUTPUT', $form, 'html_form_output', false); 72 73 print '</div>'.DOKU_LF; 74 } 75 76} 77