Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 6839 | Rev 6854 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 6839 Rev 6849
Línea 45... Línea 45...
45
use LeadersLinked\Model\UserPassword;
45
use LeadersLinked\Model\UserPassword;
Línea 46... Línea 46...
46
 
46
 
47
use LeadersLinked\Model\Connection;
47
use LeadersLinked\Model\Connection;
48
use LeadersLinked\Authentication\AuthImpersonateAdapter;
48
use LeadersLinked\Authentication\AuthImpersonateAdapter;
49
use LeadersLinked\Model\Network;
49
use LeadersLinked\Model\Network;
-
 
50
use LeadersLinked\Cache\CacheInterface;
-
 
51
use LeadersLinked\Cache\CacheImpl;
Línea 50... Línea 52...
50
use LeadersLinked\Cache\CacheInterface;;
52
 
51
 
53
 
52
 
54
 
53
class AuthController extends AbstractActionController
55
class AuthController extends AbstractActionController
54
{
56
{
55
    /**
57
    /**
56
     *
58
     *
Línea 57... Línea -...
57
     * @var AdapterInterface
-
 
58
     */
-
 
59
    private $adapter;
-
 
60
    
-
 
61
    
-
 
62
    /**
-
 
63
     *
-
 
64
     * @var CacheInterface
59
     * @var AdapterInterface
65
     */
60
     */
66
    private $cache;
61
    private $adapter;
67
    
62
    
68
    /**
63
    /**
Línea 75... Línea 70...
75
     * 
70
     * 
76
     * @var array
71
     * @var array
77
     */
72
     */
78
    private $config;
73
    private $config;
Línea -... Línea 74...
-
 
74
    
-
 
75
    /**
-
 
76
     * 
-
 
77
     * @var CacheInterface
-
 
78
     */
Línea 79... Línea -...
79
    
-
 
80
    
79
    private $cache;
81
    
80
    
82
    
81
 
83
    /**
82
    /**
84
     * 
-
 
85
     * @param AdapterInterface $adapter
83
     * 
86
     * @param CacheInterface $cache
84
     * @param AdapterInterface $adapter
87
     * @param LoggerInterface $logger
85
     * @param LoggerInterface $logger
88
     * @param array $config
86
     * @param array $config
89
     */
87
     */
90
    public function __construct($adapter, $cache , $logger, $config)
88
    public function __construct($adapter, $logger, $config)
91
    {
-
 
92
        $this->adapter      = $adapter;
89
    {
93
        $this->cache        = $cache;
90
        $this->adapter      = $adapter;
-
 
91
        $this->logger       = $logger;
94
        $this->logger       = $logger;
92
        $this->config       = $config;
Línea 95... Línea 93...
95
        $this->config       = $config;
93
        $this->cache    = CacheImpl::getInstance($config);
96
    }
94
    }
97
    
95
    
Línea 192... Línea 190...
192
                        $reader = new GeoIp2Reader($filename); //GeoIP2-City.mmdb');
190
                        $reader = new GeoIp2Reader($filename); //GeoIP2-City.mmdb');
193
                        $record = $reader->city($ip);
191
                        $record = $reader->city($ip);
194
                        if($record) {
192
                        if($record) {
195
                            $userIp = new UserIp();
193
                            $userIp = new UserIp();
196
                            $userIp->user_id = $user->id;
194
                            $userIp->user_id = $user->id;
197
                            $userIp->city = !empty($record->city->name) ? utf8_decode($record->city->name) : '';
195
                            $userIp->city = !empty($record->city->name) ? Functions::utf8_decode($record->city->name) : '';
198
                            $userIp->state_code = !empty($record->mostSpecificSubdivision->isoCode) ? utf8_decode($record->mostSpecificSubdivision->isoCode) : '';
196
                            $userIp->state_code = !empty($record->mostSpecificSubdivision->isoCode) ? Functions::utf8_decode($record->mostSpecificSubdivision->isoCode) : '';
199
                            $userIp->state_name = !empty($record->mostSpecificSubdivision->name) ? utf8_decode($record->mostSpecificSubdivision->name) : '';
197
                            $userIp->state_name = !empty($record->mostSpecificSubdivision->name) ? Functions::utf8_decode($record->mostSpecificSubdivision->name) : '';
200
                            $userIp->country_code = !empty($record->country->isoCode) ? utf8_decode($record->country->isoCode) : '';
198
                            $userIp->country_code = !empty($record->country->isoCode) ? Functions::utf8_decode($record->country->isoCode) : '';
201
                            $userIp->country_name = !empty($record->country->name) ? utf8_decode($record->country->name) : '';
199
                            $userIp->country_name = !empty($record->country->name) ? Functions::utf8_decode($record->country->name) : '';
202
                            $userIp->ip = $ip;
200
                            $userIp->ip = $ip;
203
                            $userIp->latitude = !empty($record->location->latitude) ? $record->location->latitude : 0;
201
                            $userIp->latitude = !empty($record->location->latitude) ? $record->location->latitude : 0;
204
                            $userIp->longitude = !empty($record->location->longitude) ? $record->location->longitude : 0;
202
                            $userIp->longitude = !empty($record->location->longitude) ? $record->location->longitude : 0;
205
                            $userIp->postal_code = !empty($record->postal->code) ? $record->postal->code : '';
203
                            $userIp->postal_code = !empty($record->postal->code) ? $record->postal->code : '';
Línea 233... Línea 231...
233
                    
231
                    
Línea 234... Línea 232...
234
                    
232
                    
Línea 235... Línea 233...
235
                    
233
                    
236
                    $this->logger->info('Ingreso a LeadersLiked', ['user_id' => $user->id, 'ip' => Functions::getUserIP()]);
234
                    $this->logger->info('Ingreso a LeadersLiked', ['user_id' => $user->id, 'ip' => Functions::getUserIP()]);
237
                    
235
                    
238
                    $user_share_invitation = $this->cache->get('user_share_invitation');
236
                    $user_share_invitation = $this->cache->getItem('user_share_invitation');
Línea 265... Línea 263...
265
                    $data = [
263
                    $data = [
266
                        'success'   => true,
264
                        'success'   => true,
267
                        'data'      => $this->url()->fromRoute('dashboard'),
265
                        'data'      => $this->url()->fromRoute('dashboard'),
268
                    ];
266
                    ];
Línea 269... Línea 267...
269
                   
267
                   
Línea 270... Línea 268...
270
                    $this->cache->delete('user_share_invitation');
268
                    $this->cache->removeItem('user_share_invitation');
Línea 271... Línea 269...
271
                    
269
                    
Línea 421... Línea 419...
421
                    
419
                    
Línea 422... Línea 420...
422
                ];
420
                ];
-
 
421
                
-
 
422
                
-
 
423
            } else {
-
 
424
                $sandbox = $this->config['leaderslinked.runmode.sandbox'];
-
 
425
                if ($sandbox) {
-
 
426
                    $google_map_key  = $this->config['leaderslinked.google_map.sandbox_api_key'];
-
 
427
                } else {
423
                
428
                    $google_map_key  = $this->config['leaderslinked.google_map.production_api_key'];
424
                
429
                }
425
            } else {
430
                
426
                $form = new SigninForm($this->config);
431
                $form = new SigninForm($this->config);
427
                $form->setData([
432
                $form->setData([
Línea 432... Línea 437...
432
                $viewModel = new ViewModel();
437
                $viewModel = new ViewModel();
433
                $viewModel->setTemplate('leaders-linked/auth/signin.phtml');
438
                $viewModel->setTemplate('leaders-linked/auth/signin.phtml');
434
                $viewModel->setVariables([
439
                $viewModel->setVariables([
435
                    'form'      =>  $form,
440
                    'form'      =>  $form,
436
                    'site_key'  => $site_key,
441
                    'site_key'  => $site_key,
-
 
442
                    'google_map_key' => $google_map_key,
437
                    'aes'       => $_SESSION['aes'],
443
                    'aes'       => $_SESSION['aes'],
438
                    'defaultNetwork' => $currentNetwork->default,
444
                    'defaultNetwork' => $currentNetwork->default,
439
                    'access_usign_social_networks' => $access_usign_social_networks && $currentNetwork->default == Network::DEFAULT_YES ? 'y' : 'n',
445
                    'access_usign_social_networks' => $access_usign_social_networks && $currentNetwork->default == Network::DEFAULT_YES ? 'y' : 'n',
440
                ]);
446
                ]);
Línea 1088... Línea 1094...
1088
                        'success' => false,
1094
                        'success' => false,
1089
                        'data' => 'ERROR_EMAIL_IS_REGISTERED'
1095
                        'data' => 'ERROR_EMAIL_IS_REGISTERED'
1090
                    ]);
1096
                    ]);
1091
                } else {
1097
                } else {
Línea 1092... Línea 1098...
1092
                    
1098
                    
Línea 1093... Línea 1099...
1093
                    $user_share_invitation = $this->cache->get('user_share_invitation');
1099
                    $user_share_invitation = $this->cache->getItem('user_share_invitation');
1094
 
1100
 
1095
                    
1101
                    
Línea 1144... Línea 1150...
1144
                                    
1150
                                    
1145
                                    $connectionMapper->insert($connection);
1151
                                    $connectionMapper->insert($connection);
Línea 1146... Línea 1152...
1146
                                }
1152
                                }
Línea 1147... Línea 1153...
1147
                                
1153
                                
1148
                                
1154
                                
Línea 1363... Línea 1369...
1363
 
1369
 
Línea 1364... Línea 1370...
1364
                        $this->logger->info('Verificación email realizada ', ['user_id' => $user->id, 'ip' => Functions::getUserIP()]);
1370
                        $this->logger->info('Verificación email realizada ', ['user_id' => $user->id, 'ip' => Functions::getUserIP()]);
Línea 1365... Línea 1371...
1365
                        
1371
                        
1366
                        
1372
                        
1367
                    
1373
                    
1368
                        $user_share_invitation = $this->cache->get('user_share_invitation');
1374
                        $user_share_invitation = $this->cache->getItem('user_share_invitation');
Línea 1390... Línea 1396...
1390
                            }
1396
                            }
1391
                        }
1397
                        }
Línea 1392... Línea 1398...
1392
                        
1398
                        
Línea 1393... Línea 1399...
1393
    
1399
    
1394
                        
1400
                        
1395
                        $this->cache->delete('user_share_invitation');
1401
                        $this->cache->removeItem('user_share_invitation');