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;


class ResetPasswordForm extends Form
{

    /**
     *
     * @param array $config
     */
    public function __construct($config) 
    {

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


         $this->add([
             'name' => 'password',
             'type' => \Laminas\Form\Element\Password::class,
             'attributes' => [
                 'maxlength' => 16,
                 'id' => 'password',
             ]
         ]);
         $this->add([
             'name' => 'confirmation',
             'type' => \Laminas\Form\Element\Password::class,
             'attributes' => [
                 'maxlength' => 16,
                 'id' => 'confirmation',
             ]
         ]);
         
         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,
             ],
         ]);
    }

      
}