public function __construct($useOldPassword = true) { parent::__construct(); $this->setAttribute('method', 'post'); $this->setAttribute('class', 'panel-body'); if ($useOldPassword) { $oldPassword = new Password('oldPassword'); $oldPassword->setLabel('old.password'); $oldPassword->setAttribute('class', 'form-control'); $this->add($oldPassword); } $password = new Password('password'); $password->setLabel('password'); $password->setAttribute('class', 'form-control'); $this->add($password); $password2 = new Password('password2'); $password2->setLabel('repeat.password'); $password2->setAttribute('class', 'form-control'); $this->add($password2); $captcha = new Captcha('register_captcha'); $imageAdapter = new Image(['font' => __DIR__ . '/../../fonts/arial.ttf']); $imageAdapter->setHeight(100); $imageAdapter->setWidth(400); $imageAdapter->setFontSize(48); $imageAdapter->setDotNoiseLevel(400); $imageAdapter->setLineNoiseLevel(40); $captcha->setCaptcha($imageAdapter); $captcha->setLabel('enter.text.from.the.picture'); $captcha->setAttribute('class', 'form-control'); $this->add($captcha); $submit = new Submit('save'); $submit->setValue('save'); $submit->setAttribute('class', 'btn btn-primary'); $this->add($submit); }
/** * @param null|string $name */ public function __construct($serviceLocator, $options = null) { parent::__construct('signin'); $this->setServiceLocator($serviceLocator); $this->setAttribute('method', 'post'); $this->setOptions(['layout' => 'fluid']); $filter = $this->getInputFilter(); //$groupBasic = new DisplayGroup('groupBasic'); //$this->add($groupBasic); $csrf = new Csrf('csrf'); $this->add($csrf); $filter->add(array('name' => 'csrf', 'required' => false, 'filters' => array(array('name' => 'StringTrim')))); $mail = new Text('mail'); $mail->setLabel('Email:'); $mail->setAttributes(array('type' => 'text', 'id' => 'mail')); $this->add($mail); //$groupBasic->addElement($username); $filter->add(array('name' => 'mail', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập email đăng nhập'))), array('name' => 'EmailAddress', 'break_chain_on_failure' => true, 'options' => array('messages' => array('emailAddressInvalidFormat' => 'Địa chỉ email không hợp lệ')))))); $password = new Password('password'); $password->setAttributes(array('type' => 'password', 'id' => 'password')); $password->setLabel('Mật khẩu:'); $this->add($password); //$groupBasic->addElement($password); $filter->add(array('name' => 'password', 'required' => true, 'validators' => array(array('name' => 'NotEmpty', 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập mật khẩu')))))); $config = $this->getServiceLocator()->get('Config'); $this->captcha = new ReCaptcha(array('pubkey' => $config['captcha']['reCAPTCHA']['publicKey'], 'privkey' => $config['captcha']['reCAPTCHA']['privateKey'], 'ssl' => !isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off' ? false : true)); $captcha = new Captcha('captcha'); $captcha->setLabel('Mã bảo mật:'); $captcha->setCaptcha($this->captcha); $this->add($captcha); //$groupBasic->addElement($captcha); $filter->add(array('name' => 'captcha', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập captcha'))), $this->captcha))); $this->add(array('name' => 'submit', 'attributes' => array('type' => 'submit', 'value' => 'Đăng nhập', 'id' => 'btnSignin', 'class' => 'btn btn-primary col-md-12'))); //$groupBasic->addElement($this->get('submit')); }
/** * @param null|string $name */ public function __construct($serviceLocator, $options = null) { parent::__construct('passwordForgot'); $this->setServiceLocator($serviceLocator); $this->setAttribute('method', 'post'); $filter = $this->getInputFilter(); $groupBasic = new DisplayGroup('groupBasic'); $this->add($groupBasic); $email = new Text('email'); $email->setLabel('Email:'); $email->setAttributes(['maxlength' => 255, 'autocomplete' => 'off']); $email->setOptions(['descriptions' => ['Nhập email khi bạn đăng ký tài khoản']]); $this->add($email); $groupBasic->addElement($email); $filter->add(array('name' => 'email', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập email'))), array('name' => 'StringLength', 'break_chain_on_failure' => true, 'options' => array('max' => 50, 'min' => 4, 'messages' => array(StringLength::TOO_LONG => 'Tên đăng nhập giới hạn 4-50 kí tự', StringLength::TOO_SHORT => 'Tên đăng nhập giới hạn 4-50 kí tự'))), array('name' => 'EmailAddress', 'break_chain_on_failure' => true, 'options' => array('messages' => array('emailAddressInvalidFormat' => 'Địa chỉ email không hợp lệ')))))); $config = $this->getServiceLocator()->get('Config'); $this->captcha = new ReCaptcha(array('pubkey' => $config['captcha']['reCAPTCHA']['publicKey'], 'privkey' => $config['captcha']['reCAPTCHA']['privateKey'], 'ssl' => !isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off' ? false : true)); $this->captcha->setPrivkey($config['captcha']['reCAPTCHA']['privateKey']); $this->captcha->setPubkey($config['captcha']['reCAPTCHA']['publicKey']); $captcha = new Captcha('captcha'); $captcha->setLabel('Mã bảo mật:'); $captcha->setCaptcha($this->captcha); $this->add($captcha); $groupBasic->addElement($captcha); $filter->add(array('name' => 'captcha', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập email'))), $this->captcha))); $this->add(array('name' => 'submit', 'attributes' => array('type' => 'submit', 'value' => 'Khôi phục mật khẩu', 'id' => 'btnSubmit', 'class' => 'htmlBtn first btn btn-primary'), 'options' => array('clearBefore' => true, 'decorator' => array('type' => 'li', 'attributes' => array('class' => 'btns'))))); }
public function __construct() { parent::__construct(); $this->setAttribute('method', 'post'); $this->setAttribute('class', 'panel-body'); $mail = new Email('email'); $mail->setLabel('email'); $mail->setAttribute('class', 'form-control'); $this->add($mail); $captcha = new Captcha('register_captcha'); $imageAdapter = new Image(['font' => __DIR__ . '/../../fonts/arial.ttf']); $imageAdapter->setHeight(100); $imageAdapter->setWidth(400); $imageAdapter->setFontSize(48); $imageAdapter->setDotNoiseLevel(400); $imageAdapter->setLineNoiseLevel(40); $captcha->setCaptcha($imageAdapter); $captcha->setLabel('enter.text.from.the.picture'); $captcha->setAttribute('class', 'form-control'); $this->add($captcha); $submit = new Submit('send'); $submit->setValue('send'); $submit->setAttribute('class', 'btn btn-primary'); $this->add($submit); }
/** * Init Module form * * @return void */ public function init() { $showEmail = new Element\Checkbox('show_email'); $showEmail->setLabel('Show email'); $showEmail->setAttribute('required', 'required')->setAttribute('id', 'show-email'); $username = new Element\Text('username'); $username->setLabel('Username'); $username->setAttribute('required', 'required')->setAttribute('id', 'username'); $email = new Element\Text('email'); $email->setLabel('Email'); $email->setAttribute('required', 'required')->setAttribute('id', 'email'); $message = new Element\Textarea('message'); $message->setLabel('Message'); $message->setAttribute('required', 'required')->setAttribute('id', 'message'); $captchaImage = new CaptchaImage(array('font' => GC_PUBLIC_PATH . '/backend/fonts/arial.ttf', 'width' => 250, 'height' => 50, 'dotNoiseLevel' => 40, 'lineNoiseLevel' => 3)); $captchaImage->setImgDir(GC_PUBLIC_PATH . '/frontend/tmp'); $captchaImage->setImgUrl('/frontend/tmp'); $captcha = new Element\Captcha('captcha'); $captcha->setLabel('Please verify you are human')->setCaptcha($captchaImage)->setAttribute('required', 'required')->setAttribute('id', 'captcha'); $this->add($showEmail); $this->add($username); $this->add($email); $this->add($message); $this->add($captcha); $inputFilterFactory = new InputFilterFactory(); $inputFilter = $inputFilterFactory->createInputFilter(array('show_email' => array('name' => 'show_email', 'required' => false), 'username' => array('name' => 'username', 'required' => true), 'email' => array('name' => 'email', 'required' => true, 'validators' => array(array('name' => 'email_address'))), 'message' => array('name' => 'message', 'required' => true), 'captcha' => $captcha->getInputSpecification())); $this->setInputFilter($inputFilter); }
public function __construct() { parent::__construct(); $this->setAttribute('method', 'post'); $this->setAttribute('class', 'panel-body'); $username = new Text('username'); $username->setLabel('username'); $username->setAttribute('class', 'form-control'); $username->setAttribute('data-urr', '/isusernameinuse'); $this->add($username); $mail = new Email('email'); $mail->setLabel('email'); $mail->setAttribute('class', 'form-control'); $this->add($mail); $password = new Password('password'); $password->setLabel('password'); $password->setAttribute('class', 'form-control'); $this->add($password); $password2 = new Password('password2'); $password2->setLabel('repeat.password'); $password2->setAttribute('class', 'form-control'); $this->add($password2); $captcha = new Captcha('registerCaptcha'); $imageAdapter = new Image(['font' => __DIR__ . '/../../fonts/arial.ttf']); $imageAdapter->setHeight(100); $imageAdapter->setWidth(400); $imageAdapter->setFontSize(48); $imageAdapter->setDotNoiseLevel(400); $imageAdapter->setLineNoiseLevel(40); $captcha->setCaptcha($imageAdapter); $captcha->setLabel('enter.text.from.the.picture'); $captcha->setAttribute('class', 'form-control'); $this->add($captcha); $agb = new Checkbox('gtcAccept'); $agb->setLabel('accept.terms.of.gtc'); $agb->setAttribute('class', 'form-control'); $agb->setLabelAttributes(['class' => 'checkboxLabel']); $this->add($agb); $submit = new Submit('register'); $submit->setValue('register'); $submit->setAttribute('class', 'btn btn-primary'); $this->add($submit); }
public function __construct($urlcaptcha = null) { parent::__construct('User Register Form'); $this->setAttribute('method', 'post'); $this->add(array('name' => 'username', 'type' => 'Zend\\Form\\Element\\Text', 'options' => array('label' => '帳號'), 'attributes' => array('type' => 'text'))); $this->add(array('name' => 'first_name', 'type' => 'Zend\\Form\\Element\\Text', 'options' => array('label' => '姓'))); $this->add(array('name' => 'last_name', 'type' => 'Zend\\Form\\Element\\Text', 'options' => array('label' => '名'))); $this->add(array('type' => 'Zend\\Form\\Element\\Text', 'name' => 'birthday', 'options' => array('label' => '生日', 'description' => '請輸入西元年月日,例: 2000-1-1'))); $this->add(array('name' => 'sex', 'type' => 'Zend\\Form\\Element\\Select', 'options' => array('label' => '性別', 'value_options' => array('' => '請選擇', 'male' => '男', 'female' => '女')))); $this->add(array('type' => 'Zend\\Form\\Element\\Email', 'name' => 'email', 'options' => array('label' => '電子郵件'))); $this->add(array('name' => 'password', 'options' => array('label' => '密碼'), 'attributes' => array('type' => 'password', 'placeholder' => '請輸入您的密碼'))); $this->add(array('name' => 're_password', 'options' => array('label' => '確認密碼'), 'attributes' => array('type' => 'password', 'placeholder' => '再輸入一次密碼'))); $this->add(new Element\Csrf('security')); $dirdata = './data'; $captchaImage = new CaptchaImage(array('font' => $dirdata . '/fonts/arial.ttf', 'width' => 200, 'height' => 80, 'wordlen' => 5, 'dotNoiseLevel' => 40, 'lineNoiseLevel' => 8)); $captchaImage->setImgDir($dirdata . '/captcha'); $captchaImage->setImgUrl($urlcaptcha); $captcha = new Element\Captcha('captcha'); $captcha->setCaptcha($captchaImage); $captcha->setLabel('請輸入驗證碼'); $this->add($captcha); $this->add(array('name' => 'submit', 'attributes' => array('type' => 'submit', 'value' => '註冊', 'class' => 'btn btn-primary'))); }
use Zend\Form\Form; use Zend\InputFilter\Input; use Zend\InputFilter\InputFilter; $name = new Element('name'); $name->setLabel('Your name'); $name->setAttributes(array('type' => 'text')); $email = new Element\Email('email'); $email->setLabel('Your email address'); $subject = new Element('subject'); $subject->setLabel('Subject'); $subject->setAttributes(array('type' => 'text')); $message = new Element\Textarea('message'); $message->setLabel('Message'); $captcha = new Element\Captcha('captcha'); $captcha->setCaptcha(new Captcha\Dumb()); $captcha->setLabel('Please verify you are human'); $csrf = new Element\Csrf('security'); $send = new Element('send'); $send->setValue('Submit'); $send->setAttributes(array('type' => 'submit')); $form = new Form('contact'); $form->add($name); $form->add($email); $form->add($subject); $form->add($message); $form->add($captcha); $form->add($csrf); $form->add($send); $nameInput = new Input('name'); // configure input... and all others $inputFilter = new InputFilter();