Proyectos de Subversion LeadersLinked - Services

Rev

Rev 178 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
 
3
declare(strict_types=1);
4
 
5
namespace LeadersLinked\Form\Auth;
6
 
7
use Laminas\Form\Form;
8
 
9
class SigninForm extends Form
10
{
11
    /**
12
     *
13
     * @param array $config
14
     */
15
    public function __construct($config)
16
    {
17
        parent::__construct();
18
        $this->setInputFilter(new SigninFilter());
19
 
20
         $this->add([
21
            'name' => 'email',
22
            'type' => \Laminas\Form\Element\Text::class,
23
            'attributes' => [
24
                'maxlength' 	=> 250,
25
                'id' 			=> 'email',
26
            ]
27
        ]);
28
         $this->add([
29
             'name' => 'password',
30
             'type' => \Laminas\Form\Element\Password::class,
31
             'attributes' => [
283 www 32
                 'maxlength' => 25,
1 efrain 33
                 'id' => 'password',
34
             ]
35
         ]);
36
         $this->add([
37
             'name' => 'remember',
38
             'type' => \Laminas\Form\Element\Checkbox::class,
39
             'attributes' => [
40
                 'id' => 'remember',
41
             ],
42
             'options' => [
43
                'use_hidden_element' => false,
44
                'unchecked_value' => '0',
45
                'checked_value' => '1',
46
             ]
47
         ]);
48
 
49
 
178 efrain 50
 
1 efrain 51
         if($config['leaderslinked.runmode.sandbox']) {
52
             $site_key      = $config['leaderslinked.google_captcha.sandbox_site_key'];
53
             $secret_key    = $config['leaderslinked.google_captcha.sandbox_secret_key'];
54
         } else {
55
             $site_key      = $config['leaderslinked.google_captcha.production_site_key'];
56
             $secret_key    = $config['leaderslinked.google_captcha.production_secret_key'];
57
         }
58
 
59
         $curl = new \Laminas\Http\Client\Adapter\Curl();
60
         $curl = $curl->setCurlOption(CURLOPT_SSL_VERIFYHOST,false);
61
         $curl = $curl->setCurlOption(CURLOPT_SSL_VERIFYPEER,false);
62
 
63
         $httpClient = new \Laminas\Http\Client();
64
         $httpClient->setAdapter($curl);
65
 
66
 
67
         $captcha = new \Laminas\Captcha\ReCaptcha();
68
         $captcha->setService(new \Laminas\ReCaptcha\ReCaptcha($site_key, $secret_key, $params = null, $options = ['callback' => 'enableBtn'], $ip = null, $httpClient));
69
 
70
         $this->add([
71
             'type' => 'captcha',
72
             'name' => 'captcha',
73
             'attributes' => [
74
                 'data-role' => 'none',
75
             ],
76
             'options' => [
77
                 'captcha' => $captcha,
78
             ],
79
         ]);
35 efrain 80
 
178 efrain 81
 
1 efrain 82
    }
83
 
84
 
85
}