Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 6752 | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |

<?php

declare(strict_types=1);

namespace LeadersLinked\Form\Auth;

use Laminas\Form\Form;

class SigninForm extends Form
{
    /**
     *
     * @param array $config
     */
    public function __construct($config) 
    {
        parent::__construct();
        $this->setInputFilter(new SigninFilter());

         $this->add([
            'name' => 'email',
            'type' => \Laminas\Form\Element\Text::class,
            'attributes' => [
                'maxlength'     => 250,
                'id'                    => 'email',
            ]
        ]);
         $this->add([
             'name' => 'password',
             'type' => \Laminas\Form\Element\Password::class,
             'attributes' => [
                 'maxlength' => 16,
                 'id' => 'password',
             ]
         ]);
         $this->add([
             'name' => 'remember',
             'type' => \Laminas\Form\Element\Checkbox::class,
             'attributes' => [
                 'id' => 'remember',
             ],
             'options' => [
                'use_hidden_element' => false,
                'unchecked_value' => '0',
                'checked_value' => '1',
             ]
         ]);
         

         if($config['leaderslinked.runmode.sandbox']) {
             $site_key      = $config['leaderslinked.google_captcha.sandbox_site_key'];
             $secret_key    = $config['leaderslinked.google_captcha.sandbox_secret_key'];
         } else {
             $site_key      = $config['leaderslinked.google_captcha.production_site_key'];
             $secret_key    = $config['leaderslinked.google_captcha.production_secret_key'];
         }

         $curl = new \Laminas\Http\Client\Adapter\Curl();
         $curl = $curl->setCurlOption(CURLOPT_SSL_VERIFYHOST,false);
         $curl = $curl->setCurlOption(CURLOPT_SSL_VERIFYPEER,false);
         
         $httpClient = new \Laminas\Http\Client();
         $httpClient->setAdapter($curl);

         
         $captcha = new \Laminas\Captcha\ReCaptcha();
         $captcha->setService(new \Laminas\ReCaptcha\ReCaptcha($site_key, $secret_key, $params = null, $options = ['callback' => 'enableBtn'], $ip = null, $httpClient));

         $this->add([
             'type' => 'captcha',
             'name' => 'captcha',
             'attributes' => [
                 'data-role' => 'none',
             ],
             'options' => [
                 'captcha' => $captcha,
             ],
         ]);
    }

      
}