Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 www 1
<?php
2
 
3
declare(strict_types=1);
4
 
5
namespace LeadersLinked\Form\Auth;
6
 
7
use Laminas\Form\Form;
8
use Laminas\Db\Adapter\AdapterInterface;
9
 
10
class ForgotPasswordForm extends Form
11
{
12
    /**
13
     *
14
     * @param array $config
15
     */
16
    public function __construct($config)
17
    {
18
 
19
        parent::__construct();
20
        $this->setInputFilter(new ForgotPasswordFilter());
21
 
22
         $this->add([
23
            'name' => 'email',
24
            'type' => \Laminas\Form\Element\Text::class,
25
            'attributes' => [
26
                'maxlength' 	=> 64,
27
                'id' 			=> 'email',
28
            ]
29
        ]);
30
 
31
         /*
32
         $this->add([
33
             'type'  => 'captcha',
34
             'name' => 'captcha',
35
             'attributes' => [
36
                 'id' => 'captcha'
37
             ],
38
             'options' => [
39
                 'label' => 'Verificación',
40
                 'captcha' => [
41
                     'class' => 'Image',
42
                     'imgDir' => 'public/images/captcha',
43
                     'suffix' => '.png',
44
                     'imgUrl' => '/images/captcha/',
45
                     'imgAlt' => 'CAPTCHA Image',
46
                     'font'   => './data/font/ThorneShaded.ttf',
47
                     'fsize'  => 24,
48
                     'width'  => 350,
49
                     'height' => 100,
50
                     'expiration' => 600,
51
                     'dotNoiseLevel' => 40,
52
                     'lineNoiseLevel' => 3
53
                 ],
54
             ],
55
         ]);*/
56
 
57
         if($config['leaderslinked.runmode.sandbox']) {
58
             $site_key      = $config['leaderslinked.google_captcha.sandbox_site_key'];
59
             $secret_key    = $config['leaderslinked.google_captcha.sandbox_secret_key'];
60
         } else {
61
             $site_key      = $config['leaderslinked.google_captcha.production_site_key'];
62
             $secret_key    = $config['leaderslinked.google_captcha.production_secret_key'];
63
         }
64
 
65
         $curl = new \Laminas\Http\Client\Adapter\Curl();
66
         $curl = $curl->setCurlOption(CURLOPT_SSL_VERIFYHOST,false);
67
         $curl = $curl->setCurlOption(CURLOPT_SSL_VERIFYPEER,false);
68
 
69
         $httpClient = new \Laminas\Http\Client();
70
         $httpClient->setAdapter($curl);
71
 
72
 
73
         $captcha = new \Laminas\Captcha\ReCaptcha();
74
         $captcha->setService(new \Laminas\ReCaptcha\ReCaptcha($site_key, $secret_key, $params = null, $options = ['callback' => 'enableBtn'], $ip = null, $httpClient));
75
 
76
 
77
         // Add the CAPTCHA field
78
         $this->add([
79
             'type' => 'captcha',
80
             'name' => 'captcha',
81
             'attributes' => [
82
                 'data-role' => 'none',
83
             ],
84
             'options' => [
85
                 'captcha' => $captcha,
86
             ],
87
         ]);
88
    }
89
 
90
 
91
}