|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace dokuwiki\Ui; |
|
4
|
|
|
|
|
5
|
|
|
use dokuwiki\Form\Form; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* DokuWiki Resend Password Request Interface |
|
9
|
|
|
* |
|
10
|
|
|
* @package dokuwiki\Ui |
|
11
|
|
|
*/ |
|
12
|
|
|
class UserResendPwd extends Ui |
|
13
|
|
|
{ |
|
14
|
|
|
/** |
|
15
|
|
|
* Display the form to request a new password for an existing account |
|
16
|
|
|
* |
|
17
|
|
|
* @author Benoit Chesneau <[email protected]> |
|
18
|
|
|
* @author Andreas Gohr <[email protected]> |
|
19
|
|
|
* |
|
20
|
|
|
* @return void |
|
21
|
|
|
*/ |
|
22
|
|
|
public function show() |
|
23
|
|
|
{ |
|
24
|
|
|
global $conf; |
|
25
|
|
|
global $INPUT; |
|
26
|
|
|
|
|
27
|
|
|
$token = preg_replace('/[^a-f0-9]+/', '', $INPUT->str('pwauth')); |
|
28
|
|
|
|
|
29
|
|
|
// print intro |
|
30
|
|
|
print p_locale_xhtml('resetpwd'); |
|
31
|
|
|
print '<div class="centeralign">'; |
|
32
|
|
|
|
|
33
|
|
|
if (!$conf['autopasswd'] && $token) { |
|
34
|
|
|
$form = $this->formSetNewPassword($token); |
|
35
|
|
|
} else { |
|
36
|
|
|
$form = $this->formResendPassword(); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
print $form->toHTML('ResendPwd'); |
|
40
|
|
|
|
|
41
|
|
|
print '</div>'; |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* create a form ui to set new password |
|
46
|
|
|
* |
|
47
|
|
|
* @params string $token cleaned pwauth request variable |
|
48
|
|
|
* @return Form |
|
49
|
|
|
*/ |
|
50
|
|
|
protected function formSetNewPassword($token) |
|
51
|
|
|
{ |
|
52
|
|
|
global $lang; |
|
53
|
|
|
|
|
54
|
|
|
// create the form |
|
55
|
|
|
$form = new Form(['id' => 'dw__resendpwd']); |
|
56
|
|
|
$form->addTagOpen('div')->addClass('no'); |
|
57
|
|
|
$form->addFieldsetOpen($lang['btn_resendpwd']); |
|
58
|
|
|
$form->setHiddenField('token', $token); |
|
59
|
|
|
$form->setHiddenField('do', 'resendpwd'); |
|
60
|
|
|
$input = $form->addPasswordInput('pass', $lang['pass'])->attr('size', '50')->addClass('edit'); |
|
61
|
|
|
$input->getLabel()->attr('class', 'block'); |
|
62
|
|
|
$form->addHTML("<br>\n"); |
|
63
|
|
|
$input = $form->addPasswordInput('passchk', $lang['passchk'])->attr('size', '50')->addClass('edit'); |
|
64
|
|
|
$input->getLabel()->attr('class', 'block'); |
|
65
|
|
|
$form->addHTML("<br>\n"); |
|
66
|
|
|
$form->addButton('', $lang['btn_resendpwd'])->attr('type', 'submit'); |
|
67
|
|
|
$form->addFieldsetClose(); |
|
68
|
|
|
$form->addTagClose('div'); |
|
69
|
|
|
return $form; |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* create a form ui to request new password |
|
74
|
|
|
* |
|
75
|
|
|
* @return Form |
|
76
|
|
|
*/ |
|
77
|
|
|
protected function formResendPassword() |
|
78
|
|
|
{ |
|
79
|
|
|
global $lang; |
|
80
|
|
|
|
|
81
|
|
|
// create the form |
|
82
|
|
|
$form = new Form(['id' => 'dw__resendpwd']); |
|
83
|
|
|
$form->addTagOpen('div')->addClass('no'); |
|
84
|
|
|
$form->addFieldsetOpen($lang['btn_resendpwd']); |
|
85
|
|
|
$form->setHiddenField('do', 'resendpwd'); |
|
86
|
|
|
$form->setHiddenField('save', '1'); |
|
87
|
|
|
$form->addHTML("<br>\n"); |
|
88
|
|
|
$input = $form->addTextInput('login', $lang['user'])->addClass('edit'); |
|
89
|
|
|
$input->getLabel()->attr('class', 'block'); |
|
90
|
|
|
$form->addHTML("<br>\n"); |
|
91
|
|
|
$form->addHTML("<br>\n"); |
|
92
|
|
|
$form->addButton('', $lang['btn_resendpwd'])->attr('type', 'submit'); |
|
93
|
|
|
$form->addFieldsetClose(); |
|
94
|
|
|
$form->addTagClose('div'); |
|
95
|
|
|
return $form; |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
} |
|
99
|
|
|
|