Example #1
0
 public function __construct(AuthenticationOptionsInterface $options)
 {
     $identityParams = array('name' => 'identity', 'required' => true, 'validators' => array());
     $identityFields = $options->getAuthIdentityFields();
     if ($identityFields == array('email')) {
         $validators = array('name' => 'EmailAddress');
         array_push($identityParams['validators'], $validators);
     }
     $this->add($identityParams);
     $this->add(array('name' => 'credential', 'required' => true, 'validators' => array(array('name' => 'StringLength', 'options' => array('min' => 6))), 'filters' => array(array('name' => 'StringTrim'))));
     $this->getEventManager()->trigger('init', $this);
 }
 public function __construct(AuthenticationOptionsInterface $options, $emailValidator)
 {
     $this->emailValidator = $emailValidator;
     $identityParams = array('name' => 'identity', 'required' => true, 'validators' => array());
     $identityFields = $options->getAuthIdentityFields();
     if ($identityFields == array('email')) {
         $validators = array('name' => 'EmailAddress');
         array_push($validators, $identityParams['validators']);
     }
     $this->add($identityParams);
     $this->add(array('name' => 'newIdentity', 'required' => true, 'validators' => array(array('name' => 'EmailAddress'), $this->emailValidator)));
     $this->add(array('name' => 'newIdentityVerify', 'required' => true, 'validators' => array(array('name' => 'identical', 'options' => array('token' => 'newIdentity')))));
 }
 /**
  * @param AuthenticationOptionsInterface $options
  */
 public function __construct(AuthenticationOptionsInterface $options)
 {
     $identityParams = array('name' => 'identity', 'required' => true, 'validators' => array());
     $identityFields = $options->getAuthIdentityFields();
     if ($identityFields == array('email')) {
         $validators = array('name' => 'EmailAddress');
         array_push($identityParams['validators'], $validators);
     }
     $this->add($identityParams);
     $this->add(array('name' => 'credential', 'required' => true, 'validators' => array(array('break_chain_on_failure' => true, 'name' => '\\Application\\Validator\\NotEmptyValidator', 'options' => array('campo' => \Application\Constants\UsuarioConst::LBL_SENHA_ANTIGA)), array('break_chain_on_failure' => true, 'name' => 'Application\\Validator\\PasswordStrengthValidator'), array('break_chain_on_failure' => true, 'name' => 'StringLength', 'options' => array('min' => 5, 'max' => 12))), 'filters' => array(array('name' => 'StringTrim'))));
     $this->add(array('name' => 'newCredential', 'required' => true, 'validators' => array(array('break_chain_on_failure' => true, 'name' => '\\Application\\Validator\\NotEmptyValidator', 'options' => array('campo' => \Application\Constants\UsuarioConst::LBL_NOVA_SENHA)), array('break_chain_on_failure' => true, 'name' => 'Application\\Validator\\PasswordStrengthValidator'), array('break_chain_on_failure' => true, 'name' => 'StringLength', 'options' => array('min' => 5, 'max' => 12))), 'filters' => array(array('name' => 'StringTrim'))));
     $this->add(array('name' => 'newCredentialVerify', 'required' => true, 'validators' => array(array('break_chain_on_failure' => true, 'name' => '\\Application\\Validator\\NotEmptyValidator', 'options' => array('campo' => \Application\Constants\UsuarioConst::LBL_CONFIRM_NOVA_SENHA), array('name' => 'Application\\Validator\\PasswordStrengthValidator')), array('break_chain_on_failure' => true, 'name' => 'StringLength', 'options' => array('min' => 5, 'max' => 12)), array('break_chain_on_failure' => true, 'name' => 'identical', 'options' => array('token' => 'newCredential', 'messages' => array(\Zend\Validator\Identical::NOT_SAME => Mensagens::getMensagem('M12'))))), 'filters' => array(array('name' => 'StringTrim'))));
 }