ChangePasswordForm.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace ThurData\Servers\KerioEmail\App\UI\Client\EmailAccount\Forms;
  3. use ThurData\Servers\KerioEmail\App\UI\Client\EmailAccount\Providers\EditAccountDataProvider;
  4. use ThurData\Servers\KerioEmail\App\Validators\PasswordsValidator;
  5. use ThurData\Servers\KerioEmail\App\Validators\RepeatPasswordValidator;
  6. use ThurData\Servers\KerioEmail\Core\UI\Interfaces\ClientArea;
  7. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\BaseForm;
  8. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Hidden;
  9. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Password;
  10. /**
  11. *
  12. * Created by PhpStorm.
  13. * User: ThurData
  14. * Date: 08.11.19
  15. * Time: 12:07
  16. * Class ChangePasswordForm
  17. */
  18. class ChangePasswordForm extends BaseForm implements ClientArea
  19. {
  20. protected $id = 'changePasswordForm';
  21. protected $name = 'changePasswordForm';
  22. protected $title = 'changePasswordForm';
  23. protected function getDefaultActions()
  24. {
  25. return ['changePassword'];
  26. }
  27. public function initContent()
  28. {
  29. $this->setFormType('changePassword');
  30. $this->dataProvider = new EditAccountDataProvider();
  31. $field = new Hidden('id');
  32. $this->addField($field);
  33. /**end**/
  34. $field = new Password('password');
  35. $field->setDescription('description');
  36. $field->addValidator(new PasswordsValidator());
  37. $field->notEmpty();
  38. $this->addField($field);
  39. $field = (new Password('repeat_password'))->addValidator(new RepeatPasswordValidator());
  40. $field->notEmpty();
  41. $this->addField($field);
  42. $this->loadDataToForm();
  43. }
  44. }