1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* BB's Zend Framework 2 Components |
4
|
|
|
* |
5
|
|
|
* AdminModule |
6
|
|
|
* |
7
|
|
|
* @package [MyApplication] |
8
|
|
|
* @package BB's Zend Framework 2 Components |
9
|
|
|
* @package AdminModule |
10
|
|
|
* @author Björn Bartels <[email protected]> |
11
|
|
|
* @link https://gitlab.bjoernbartels.earth/groups/zf2 |
12
|
|
|
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 |
13
|
|
|
* @copyright copyright (c) 2016 Björn Bartels <[email protected]> |
14
|
|
|
*/ |
15
|
|
|
|
16
|
|
|
namespace Admin\Form; |
17
|
|
|
|
18
|
|
|
use Zend\Form\Form; |
19
|
|
|
use Zend\InputFilter\InputFilter; |
20
|
|
|
use Zend\InputFilter\Factory as InputFactory; |
21
|
|
|
|
22
|
|
|
class ResetPasswordForm extends Form |
23
|
|
|
{ |
24
|
|
|
protected $inputFilter; |
25
|
|
|
|
26
|
|
|
public function __construct($name = null) |
27
|
|
|
{ |
28
|
|
|
// we want to ignore the name passed |
29
|
|
|
parent::__construct($name); |
30
|
|
|
$this->setAttribute('method', 'post'); |
31
|
|
|
|
32
|
|
|
$this->add( |
33
|
|
|
array( |
34
|
|
|
'name' => 'identity', |
35
|
|
|
'options' => array( |
36
|
|
|
'label' => '', |
37
|
|
|
), |
38
|
|
|
'attributes' => array( |
39
|
|
|
'type' => 'hidden' |
40
|
|
|
), |
41
|
|
|
) |
42
|
|
|
); |
43
|
|
|
|
44
|
|
|
$this->add( |
45
|
|
|
array( |
46
|
|
|
'name' => 'token', |
47
|
|
|
'options' => array( |
48
|
|
|
'label' => '', |
49
|
|
|
), |
50
|
|
|
'attributes' => array( |
51
|
|
|
'type' => 'hidden' |
52
|
|
|
), |
53
|
|
|
) |
54
|
|
|
); |
55
|
|
|
|
56
|
|
|
$this->add( |
57
|
|
|
array( |
58
|
|
|
'name' => 'newCredential', |
59
|
|
|
'options' => array( |
60
|
|
|
'label' => 'New Password', |
61
|
|
|
), |
62
|
|
|
'attributes' => array( |
63
|
|
|
'type' => 'password', |
64
|
|
|
), |
65
|
|
|
) |
66
|
|
|
); |
67
|
|
|
|
68
|
|
|
$this->add( |
69
|
|
|
array( |
70
|
|
|
'name' => 'newCredentialVerify', |
71
|
|
|
'type' => 'password', |
72
|
|
|
'options' => array( |
73
|
|
|
'label' => 'Verify New Password', |
74
|
|
|
), |
75
|
|
|
'attributes' => array( |
76
|
|
|
'type' => 'password', |
77
|
|
|
), |
78
|
|
|
) |
79
|
|
|
); |
80
|
|
|
|
81
|
|
|
$this->add( |
82
|
|
|
array( |
83
|
|
|
'name' => 'submit', |
84
|
|
|
'attributes' => array( |
85
|
|
|
'type' => 'submit', |
86
|
|
|
'value' => 'reset password', |
87
|
|
|
'id' => 'submitbutton', |
88
|
|
|
), |
89
|
|
|
'options' => array( |
90
|
|
|
'label' => 'reset password', |
91
|
|
|
), |
92
|
|
|
) |
93
|
|
|
); |
94
|
|
|
|
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
public function getInputFilter() |
98
|
|
|
{ |
99
|
|
|
if (!$this->inputFilter) { |
100
|
|
|
$inputFilter = new InputFilter(); |
101
|
|
|
$factory = new InputFactory(); |
102
|
|
|
|
103
|
|
|
$inputFilter->add( |
104
|
|
|
$factory->createInput( |
105
|
|
|
array( |
106
|
|
|
'name' => 'identity', |
107
|
|
|
'required' => true, |
108
|
|
|
'filters' => array( |
109
|
|
|
array('name' => 'StripTags'), |
110
|
|
|
array('name' => 'StringTrim'), |
111
|
|
|
), |
112
|
|
|
'validators' => array( |
113
|
|
|
array( |
114
|
|
|
'name' => 'StringLength', |
115
|
|
|
'options' => array( |
116
|
|
|
'encoding' => 'UTF-8', |
117
|
|
|
'min' => 1, |
118
|
|
|
'max' => 100, |
119
|
|
|
), |
120
|
|
|
), |
121
|
|
|
array( |
122
|
|
|
'name' => 'EmailAddress', |
123
|
|
|
), |
124
|
|
|
), |
125
|
|
|
) |
126
|
|
|
) |
127
|
|
|
); |
128
|
|
|
|
129
|
|
|
$inputFilter->add( |
130
|
|
|
$factory->createInput( |
131
|
|
|
array( |
132
|
|
|
'name' => 'token', |
133
|
|
|
'required' => true, |
134
|
|
|
'filters' => array( |
135
|
|
|
array('name' => 'StripTags'), |
136
|
|
|
array('name' => 'StringTrim'), |
137
|
|
|
), |
138
|
|
|
'validators' => array( |
139
|
|
|
array( |
140
|
|
|
'name' => 'StringLength', |
141
|
|
|
'options' => array( |
142
|
|
|
'encoding' => 'UTF-8', |
143
|
|
|
'min' => 1, |
144
|
|
|
'max' => 100, |
145
|
|
|
), |
146
|
|
|
), |
147
|
|
|
), |
148
|
|
|
) |
149
|
|
|
) |
150
|
|
|
); |
151
|
|
|
|
152
|
|
|
$inputFilter->add( |
153
|
|
|
$factory->createInput( |
154
|
|
|
array( |
155
|
|
|
'name' => 'newCredential', |
156
|
|
|
'required' => true, |
157
|
|
|
'filters' => array( |
158
|
|
|
array('name' => 'StripTags'), |
159
|
|
|
array('name' => 'StringTrim'), |
160
|
|
|
), |
161
|
|
|
'validators' => array( |
162
|
|
|
array( |
163
|
|
|
'name' => 'StringLength', |
164
|
|
|
'options' => array( |
165
|
|
|
'encoding' => 'UTF-8', |
166
|
|
|
'min' => 6, |
167
|
|
|
'max' => 32, |
168
|
|
|
), |
169
|
|
|
), |
170
|
|
|
), |
171
|
|
|
) |
172
|
|
|
) |
173
|
|
|
); |
174
|
|
|
|
175
|
|
|
$inputFilter->add( |
176
|
|
|
$factory->createInput( |
177
|
|
|
array( |
178
|
|
|
'name' => 'newCredentialVerify', |
179
|
|
|
'required' => true, |
180
|
|
|
'filters' => array( |
181
|
|
|
array('name' => 'StripTags'), |
182
|
|
|
array('name' => 'StringTrim'), |
183
|
|
|
), |
184
|
|
|
'validators' => array( |
185
|
|
|
array( |
186
|
|
|
'name' => 'StringLength', |
187
|
|
|
'options' => array( |
188
|
|
|
'encoding' => 'UTF-8', |
189
|
|
|
'min' => 6, |
190
|
|
|
'max' => 32, |
191
|
|
|
), |
192
|
|
|
), |
193
|
|
|
array( |
194
|
|
|
'name' => 'Identical', |
195
|
|
|
'options' => array( |
196
|
|
|
'token' => 'newCredential', |
197
|
|
|
), |
198
|
|
|
), |
199
|
|
|
), |
200
|
|
|
) |
201
|
|
|
) |
202
|
|
|
); |
203
|
|
|
|
204
|
|
|
$this->filter = $inputFilter; |
205
|
|
|
} |
206
|
|
|
|
207
|
|
|
return $this->filter; |
208
|
|
|
} |
209
|
|
|
|
210
|
|
|
} |