public function init() { $oTradutor = $this->getTranslator(); $oBaseUrlHelper = new Zend_View_Helper_BaseUrl(); $this->setName('formLiberacaoUsuario'); $this->setAction($oBaseUrlHelper->baseUrl('/default/cadastro-eventual/confirmar')); $this->setMethod('post'); $oElm = $this->createElement('text', 'hash', array('divspan' => 9)); $oElm->setLabel('Código Verificação:'); $oElm->setAttrib('class', 'span7'); $oElm->setRequired(TRUE); $oElm->removeDecorator('errors'); $this->addElement($oElm); $oElm = $this->createElement('text', 'cnpjcpf', array('divspan' => 9)); $oElm->setLabel('CPF / CNPJ:'); $oElm->setAttrib('class', 'span3 mask-cpf-cnpj'); $oElm->setAttrib('maxlength', 18); $oElm->addValidator(new DBSeller_Validator_CpfCnpj()); $oElm->addFilter(new Zend_Filter_Digits()); $oElm->setRequired(TRUE); $oElm->removeDecorator('errors'); $this->addElement($oElm); $oValidaTamanhoCampo = new Zend_Validate_StringLength(); $oValidaTamanhoCampo->setMin('6'); $sMensagemValidacao = $oTradutor->_(sprintf('Os campos "<b>Senha</b>" e "<b>Confirme a Senha</b>" devem possuir no mínimo %s caracteres.', $oValidaTamanhoCampo->getMin())); $oElm = $this->createElement('password', 'senha', array('divspan' => 9)); $oElm->setLabel('Senha:'); $oElm->setAttrib('minlength', $oValidaTamanhoCampo->getMin()); $oElm->addValidator(new Zend_Validate_Identical('senharepetida')); $oElm->setAttrib('message-error', $sMensagemValidacao); $oElm->setAttrib('class', 'span3'); $oElm->setRequired(TRUE); $oElm->addValidator($oValidaTamanhoCampo); $oElm->removeDecorator('errors'); $this->addElement($oElm); $oElm = $this->createElement('password', 'senharepetida', array('divspan' => 10)); $oElm->setLabel('Confirme a Senha:'); $oElm->setAttrib('class', 'span3'); $oElm->setAttrib('minlength', $oValidaTamanhoCampo->getMin()); $oElm->addValidator(new Zend_Validate_Identical('senha')); $oElm->addValidator($oValidaTamanhoCampo); $oElm->setRequired(TRUE); $oElm->removeDecorator('errors'); $this->addElement($oElm); $this->addDisplayGroup(array('hash', 'cnpjcpf', 'senha', 'senharepetida'), 'dados_liberacao', array('legend' => 'Confirme seu Cadastro')); $this->addElement('submit', 'confirmar', array('label' => 'Confirmar', 'style' => 'margin-left:30px', 'buttonType' => Twitter_Bootstrap_Form_Element_Submit::BUTTON_PRIMARY)); }
public function init() { $oBaseUrlHelper = new Zend_View_Helper_BaseUrl(); $this->setName('formRecuperarSenha'); $this->setAction($oBaseUrlHelper->baseUrl('/auth/login/recuperar-senha-post')); $this->setMethod('post'); $oElm = $this->createElement('text', 'hash', array('divspan' => 9)); $oElm->setLabel('Código Verificação:'); $oElm->setAttrib('class', 'span7'); $oElm->setRequired(TRUE); $oElm->removeDecorator('errors'); $this->addElement($oElm); $oElm = $this->createElement('text', 'email', array('divspan' => 9)); $oElm->setLabel('Email:'); $oElm->setAttrib('class', 'span7'); $oElm->setAttrib('maxlength', 100); $oElm->addValidator(new Zend_Validate_EmailAddress()); $oElm->setRequired(TRUE); $oElm->removeDecorator('errors'); $this->addElement($oElm); $oValidaTamanhoCampo = new Zend_Validate_StringLength(); $oValidaTamanhoCampo->setMin('6'); $sMensagemValidacao = 'Os campos "<b>Senha</b>" e "<b>Confirme a Senha</b>" devem ser maiores de '; $sMensagemValidacao .= " {$oValidaTamanhoCampo->getMin()} caracteres."; $oElm = $this->createElement('password', 'senha', array('divspan' => 9)); $oElm->setLabel('Senha:'); $oElm->addValidator(new Zend_Validate_Identical('senharepetida')); $oElm->setAttrib('message-error', $sMensagemValidacao); $oElm->setAttrib('class', 'span3'); $oElm->setAttrib('minlength', $oValidaTamanhoCampo->getMin()); $oElm->setRequired(TRUE); $oElm->addValidator($oValidaTamanhoCampo); $oElm->removeDecorator('errors'); $this->addElement($oElm); $oElm = $this->createElement('password', 'senharepetida', array('divspan' => 9)); $oElm->setLabel('Confirme a Senha:'); $oElm->setAttrib('class', 'span3'); $oElm->setAttrib('minlength', $oValidaTamanhoCampo->getMin()); $oElm->addValidator(new Zend_Validate_Identical('senha')); $oElm->addValidator($oValidaTamanhoCampo); $oElm->setRequired(TRUE); $oElm->removeDecorator('errors'); $this->addElement($oElm); $this->addDisplayGroup(array('hash', 'email', 'senha', 'senharepetida'), 'dados_liberacao', array('legend' => 'Recuperação de Senha')); $this->addElement('submit', 'confirmar', array('label' => 'Confirmar', 'class' => 'span2', 'style' => 'margin-left:30px', 'buttonType' => Twitter_Bootstrap_Form_Element_Submit::BUTTON_PRIMARY)); }
/** * Set length * * @return int */ public function getLength() { return parent::getMin(); }
/** * Ensures that getMin() returns expected default value * * @return void */ public function testGetMin() { $this->assertEquals(0, $this->_validator->getMin()); }