Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Autoría | Ultima modificación | Ver Log |

<?php

declare(strict_types=1);

namespace LeadersLinked\Form\Auth;

use Laminas\Form\Form;
use Laminas\Db\Adapter\AdapterInterface;

class ForgotPasswordForm extends Form
{
    /**
     *
     * @param array $config
     */
    public function __construct($config) 
    {

        parent::__construct();
        $this->setInputFilter(new ForgotPasswordFilter());

         $this->add([
            'name' => 'email',
            'type' => \Laminas\Form\Element\Text::class,
            'attributes' => [
                'maxlength'     => 64,
                'id'                    => 'email',
            ]
        ]);

         /*
         $this->add([
             'type'  => 'captcha',
             'name' => 'captcha',
             'attributes' => [
                 'id' => 'captcha'
             ],
             'options' => [
                 'label' => 'Verificación',
                 'captcha' => [
                     'class' => 'Image',
                     'imgDir' => 'public/images/captcha',
                     'suffix' => '.png',
                     'imgUrl' => '/images/captcha/',
                     'imgAlt' => 'CAPTCHA Image',
                     'font'   => './data/font/ThorneShaded.ttf',
                     'fsize'  => 24,
                     'width'  => 350,
                     'height' => 100,
                     'expiration' => 600,
                     'dotNoiseLevel' => 40,
                     'lineNoiseLevel' => 3
                 ],
             ],
         ]);*/
         
         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));
         
         
         // Add the CAPTCHA field
         $this->add([
             'type' => 'captcha',
             'name' => 'captcha',
             'attributes' => [
                 'data-role' => 'none',
             ],
             'options' => [
                 'captcha' => $captcha,
             ],
         ]);
    }

      
}