public function __construct($name = 'register-form', CaptchaOptions $options, $role = 'recruiter') { parent::__construct($name, []); $this->setAttribute('data-handle-by', 'native'); $this->setAttribute('class', 'form-horizontal'); $fieldset = new Fieldset('register'); $fieldset->setOptions(array('renderFieldset' => true)); $fieldset->add(array('type' => 'text', 'name' => 'name', 'options' => array('label' => 'Name'))); $fieldset->add(array('type' => 'email', 'name' => 'email', 'options' => array('label' => 'Email'), 'attributes' => ['required' => true])); $fieldset->add(array('name' => 'role', 'type' => 'hidden', 'attributes' => array('value' => $role))); $this->add($fieldset); $mode = $options->getMode(); if (in_array($mode, [CaptchaOptions::RE_CAPTCHA, CaptchaOptions::IMAGE])) { if ($mode == CaptchaOptions::IMAGE) { $captcha = new Image($options->getImage()); } elseif ($mode == CaptchaOptions::RE_CAPTCHA) { $captcha = new ReCaptcha($options->getReCaptcha()); } if (!empty($captcha)) { $this->add(array('name' => 'captcha', 'options' => array('label' => 'Are you human?', 'captcha' => $captcha), 'type' => 'Zend\\Form\\Element\\Captcha')); } } $buttons = new ButtonsFieldset('buttons'); $buttons->add(array('type' => 'submit', 'name' => 'button', 'attributes' => array('type' => 'submit', 'value' => 'Register', 'class' => 'btn btn-primary'))); $this->add(array('name' => 'csrf', 'type' => 'csrf', 'options' => array('csrf_options' => array('salt' => str_replace('\\', '_', __CLASS__), 'timeout' => 3600)))); $this->add($buttons); }
public function __construct($name = 'register-form', $options = array()) { parent::__construct($name, $options); $this->setAttribute('data-handle-by', 'native'); $this->setAttribute('class', 'form-horizontal'); $fieldset = new Fieldset('register'); $fieldset->setOptions(array('renderFieldset' => true)); $fieldset->add(array('type' => 'text', 'name' => 'name', 'options' => array('label' => 'Name'))); $fieldset->add(array('type' => 'email', 'name' => 'email', 'options' => array('label' => 'Email'))); $fieldset->add(array('name' => 'role', 'type' => 'hidden', 'attributes' => array('value' => User::ROLE_RECRUITER))); $this->add($fieldset); if (($captchaOptions = $this->getOption('captcha')) && !empty($captchaOptions['use'])) { if ($captchaOptions['use'] === 'image' && !empty($captchaOptions['image'])) { $captcha = new Image($captchaOptions['image']); } elseif ($captchaOptions['use'] === 'reCaptcha' && !empty($captchaOptions['reCaptcha'])) { $captcha = new ReCaptcha($captchaOptions['reCaptcha']); } if (!empty($captcha)) { $this->add(array('name' => 'captcha', 'options' => array('label' => 'Are you human?', 'captcha' => $captcha), 'type' => 'Zend\\Form\\Element\\Captcha')); } } $buttons = new ButtonsFieldset('buttons'); $buttons->add(array('type' => 'submit', 'name' => 'button', 'attributes' => array('type' => 'submit', 'value' => 'Register', 'class' => 'btn btn-primary'))); $this->add(array('name' => 'csrf', 'type' => 'csrf', 'options' => array('csrf_options' => array('salt' => str_replace('\\', '_', __CLASS__), 'timeout' => 3600)))); $this->add($buttons); }
public function __construct($name = 'forgot-password', $options = array()) { parent::__construct($name, $options); $this->setAttribute('data-handle-by', 'native'); $this->setAttribute('class', 'form-horizontal'); $this->add(array('type' => 'text', 'name' => 'identity', 'options' => array('label' => 'Username or email', 'is_disable_capable' => false))); $buttons = new ButtonsFieldset('buttons'); $buttons->add(array('type' => 'submit', 'name' => 'button', 'attributes' => array('id' => 'submit', 'type' => 'submit', 'value' => 'Reset your password', 'class' => 'btn btn-primary'))); $this->add(array('name' => 'csrf', 'type' => 'csrf')); $this->add($buttons); }