Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 6751 | Ir a la última revisión | | Comparar con el anterior | 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
 
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' => [
32
                 'maxlength' => 16,
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' => [
6751 efrain 43
                'use_hidden_element' => false,
6752 efrain 44
                'unchecked_value' => '0',
45
                'checked_value' => '1',
1 www 46
             ]
47
         ]);
4776 efrain 48
 
1 www 49
         if($config['leaderslinked.runmode.sandbox']) {
50
             $site_key      = $config['leaderslinked.google_captcha.sandbox_site_key'];
51
             $secret_key    = $config['leaderslinked.google_captcha.sandbox_secret_key'];
52
         } else {
53
             $site_key      = $config['leaderslinked.google_captcha.production_site_key'];
54
             $secret_key    = $config['leaderslinked.google_captcha.production_secret_key'];
55
         }
56
 
57
         $curl = new \Laminas\Http\Client\Adapter\Curl();
58
         $curl = $curl->setCurlOption(CURLOPT_SSL_VERIFYHOST,false);
59
         $curl = $curl->setCurlOption(CURLOPT_SSL_VERIFYPEER,false);
60
 
61
         $httpClient = new \Laminas\Http\Client();
62
         $httpClient->setAdapter($curl);
63
 
64
 
65
         $captcha = new \Laminas\Captcha\ReCaptcha();
66
         $captcha->setService(new \Laminas\ReCaptcha\ReCaptcha($site_key, $secret_key, $params = null, $options = ['callback' => 'enableBtn'], $ip = null, $httpClient));
67
 
68
         $this->add([
69
             'type' => 'captcha',
70
             'name' => 'captcha',
71
             'attributes' => [
72
                 'data-role' => 'none',
73
             ],
74
             'options' => [
75
                 'captcha' => $captcha,
76
             ],
77
         ]);
78
    }
79
 
80
 
81
}