Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 18 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| tao_actions_form_ResetUserPassword | |
0.00% |
0 / 18 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
| initForm | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
| initElements | |
0.00% |
0 / 13 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; under version 2 |
| 7 | * of the License (non-upgradable). |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | * |
| 18 | * Copyright (c) 2015 (original work) Open Assessment Technologies SA; |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | use oat\generis\model\user\PasswordConstraintsService; |
| 23 | |
| 24 | /** |
| 25 | * This container initialize the password reset form. |
| 26 | * |
| 27 | * @author Aleh Hutnikau <hutnikau@1pt.com> |
| 28 | * @package tao |
| 29 | */ |
| 30 | class tao_actions_form_ResetUserPassword extends tao_helpers_form_FormContainer |
| 31 | { |
| 32 | /** |
| 33 | * Initialize password reset form |
| 34 | * |
| 35 | * @access public |
| 36 | * @author Aleh Hutnikau <hutnikau@1pt.com> |
| 37 | * @return mixed |
| 38 | */ |
| 39 | public function initForm() |
| 40 | { |
| 41 | $this->form = tao_helpers_form_FormFactory::getForm('resetUserPassword'); |
| 42 | |
| 43 | $connectElt = tao_helpers_form_FormFactory::getElement('reset', 'Submit'); |
| 44 | $connectElt->setValue(__('Update')); |
| 45 | $connectElt->setAttribute('class', 'btn-success small'); |
| 46 | $this->form->setActions([$connectElt], 'bottom'); |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Initialiaze password reset form elements |
| 51 | * |
| 52 | * @access public |
| 53 | * @author Aleh Hutnikau <hutnikau@1pt.com> |
| 54 | * @return mixed |
| 55 | */ |
| 56 | public function initElements() |
| 57 | { |
| 58 | $tokenElement = tao_helpers_form_FormFactory::getElement('token', 'Hidden'); |
| 59 | $this->form->addElement($tokenElement); |
| 60 | |
| 61 | $pass1Element = tao_helpers_form_FormFactory::getElement('newpassword', 'Hiddenbox'); |
| 62 | $pass1Element->setDescription(__('New password')); |
| 63 | $pass1Element->addValidators(PasswordConstraintsService::singleton()->getValidators()); |
| 64 | $pass1Element->setBreakOnFirstError(false); |
| 65 | $this->form->addElement($pass1Element); |
| 66 | |
| 67 | $pass2Element = tao_helpers_form_FormFactory::getElement('newpassword2', 'Hiddenbox'); |
| 68 | $pass2Element->setDescription(__('Repeat new password')); |
| 69 | $pass2Element->addValidators([ |
| 70 | tao_helpers_form_FormFactory::getValidator('Password', ['password2_ref' => $pass1Element]), |
| 71 | ]); |
| 72 | $this->form->addElement($pass2Element); |
| 73 | } |
| 74 | } |