| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- /* * ********************************************************************
- * ProxmoxAddon product developed. (Aug 23, 2018)
- * *
- *
- * CREATED BY MODULESGARDEN -> http://modulesgarden.com
- * CONTACT -> contact@modulesgarden.com
- *
- *
- * This software is furnished under a license and may be used and copied
- * only in accordance with the terms of such license and with the
- * inclusion of the above copyright notice. This software or any other
- * copies thereof may not be provided or otherwise made available to any
- * other person. No title to and ownership of the software is hereby
- * transferred.
- *
- *
- * ******************************************************************** */
- namespace ModulesGarden\Servers\ProxmoxCloudVps\App\UI\VmClone\Validators;
- use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Widget\Forms\Validators\BaseValidator;
- /**
- * Description of NumberValidator
- *
- * @author Pawel Kopec <pawelk@modulesgardne.com>
- */
- class PasswordValidator extends BaseValidator
- {
- protected $required = false;
- protected $length;
- public function __construct($required = true, $length = 5)
- {
- $this->required = $required;
- $this->length = $length;
- }
- protected function validate($data, $additionalData = null)
- {
- if($additionalData->get('formData')['osTemplate'] && $additionalData->get('formData')['osTemplate']=='installationFromIso' ){
- return true;
- }
- if (!$this->required && empty($data))
- {
- return true;
- }
- else
- {
- if (is_numeric($this->length) && strlen($data) < $this->length)
- {
- $this->addValidationError('The password is too short');
- return false;
- }
- }
- return true;
- }
- }
|