Proyectos de Subversion LeadersLinked - Services

Rev

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

Rev 211 Rev 249
Línea 159... Línea 159...
159
            } else {
159
            } else {
160
                return new JsonModel(['success' => false, 'data' => 'Unauthorized - JWT - Required',  'fatal'  => true]);
160
                return new JsonModel(['success' => false, 'data' => 'Unauthorized - JWT - Required',  'fatal'  => true]);
161
            }
161
            }
Línea -... Línea 162...
-
 
162
 
162
 
163
 
163
 
164
 
Línea 164... Línea 165...
164
            $form = new  SigninForm($this->config);
165
            $form = new  SigninForm($this->config);
165
            $dataPost = $request->getPost()->toArray();
166
            $dataPost = $request->getPost()->toArray();
166
 
167
 
167
            if (empty($_SESSION['aes'])) {
168
            if (empty($_SESSION['aes'])) {
168
                return new JsonModel([
169
                return new JsonModel([
169
                    'success'   => false,
170
                    'success'   => false,
Línea -... Línea 171...
-
 
171
                    'data'      => 'ERROR_WEBSERVICE_ENCRYPTION_KEYS_NOT_FOUND'
-
 
172
                ]);
-
 
173
            }
170
                    'data'      => 'ERROR_WEBSERVICE_ENCRYPTION_KEYS_NOT_FOUND'
174
            
171
                ]);
175
            $aes = $_SESSION['aes'];
172
            }
176
            unset( $_SESSION['aes'] );
Línea 173... Línea 177...
173
            
177
            
174
            if (!empty($dataPost['email'])) {
178
            if (!empty($dataPost['email'])) {
175
                $dataPost['email'] = CryptoJsAes::decrypt($dataPost['email'], $_SESSION['aes']);
179
                $dataPost['email'] = CryptoJsAes::decrypt($dataPost['email'], $aes);
Línea 176... Línea 180...
176
            }
180
            }
Línea 177... Línea 181...
177
 
181
 
Línea 178... Línea 182...
178
 
182
 
-
 
183
            if (!empty($dataPost['password'])) {
Línea 179... Línea 184...
179
            if (!empty($dataPost['password'])) {
184
                $dataPost['password'] = CryptoJsAes::decrypt($dataPost['password'], $aes);
180
                $dataPost['password'] = CryptoJsAes::decrypt($dataPost['password'], $_SESSION['aes']);
185
            }
181
            }
-
 
-
 
186
 
Línea 182... Línea 187...
182
 
187
            $form->setData($dataPost);
183
            $form->setData($dataPost);
188
 
184
 
189
            if ($form->isValid()) {
Línea 185... Línea 190...
185
            if ($form->isValid()) {
190
                
Línea 186... Línea 191...
186
                
191
                $dataPost = (array) $form->getData();
Línea 321... Línea 326...
321
                                $connectionMapper->insert($connection);
326
                                $connectionMapper->insert($connection);
322
                            }
327
                            }
323
                        }
328
                        }
324
                    }
329
                    }
Línea -... Línea 330...
-
 
330
 
325
 
331
                    
Línea 326... Línea 332...
326
 
332
                   
327
 
333
 
-
 
334
                    $data = [
-
 
335
                        'success'   => true,
328
                    $data = [
336
                        'data'      => [
-
 
337
                            'password_xmpp' => $password_xmpp,
329
                        'success'   => true,
338
                            'redirect' => $this->url()->fromRoute('dashboard')
Línea 330... Línea 339...
330
                        'data'      => $this->url()->fromRoute('dashboard'),
339
                         ]
331
                    ];
340
                    ];
Línea 469... Línea 478...
469
                
478
                
Línea 470... Línea 479...
470
                $token = '';
479
                $token = '';
471
                
480
                
472
                if(!empty($this->config['leaderslinked.jwt.key'])) {
481
                if(!empty($this->config['leaderslinked.jwt.key'])) {
473
                    $issuedAt   = new \DateTimeImmutable();
482
                    $issuedAt   = new \DateTimeImmutable();
474
                    $expire     = $issuedAt->modify('+24 hours')->getTimestamp();
483
                    $expire     = $issuedAt->modify('+365 days')->getTimestamp();
475
                    $serverName = $_SERVER['HTTP_HOST'];
484
                    $serverName = $_SERVER['HTTP_HOST'];
476
                    $payload = [
485
                    $payload = [
477
                        'iat'  => $issuedAt->getTimestamp(),
486
                        'iat'  => $issuedAt->getTimestamp(),
Línea 1174... Línea 1183...
1174
 
1183
 
Línea 1175... Línea 1184...
1175
                    $user_share_invitation = $this->cache->getItem('user_share_invitation');
1184
                    $user_share_invitation = $this->cache->getItem('user_share_invitation');
-
 
1185
 
-
 
1186
 
-
 
1187
                    if ($user_share_invitation) {
-
 
1188
                        
-
 
1189
                        $content_uuid = $user_share_invitation['code'];
-
 
1190
                        $content_type = $user_share_invitation['type'];
1176
 
1191
                        $content_user = $user_share_invitation['user'];
1177
 
1192
                        
1178
                    if ($user_share_invitation) {
1193
                        
Línea 1179... Línea 1194...
1179
                        $userRedirect = $userMapper->fetchOneByUuid($user_share_invitation);
1194
                        $userRedirect = $userMapper->fetchOneByUuid($content_user);
1180
                        if ($userRedirect && $userRedirect->status == User::STATUS_ACTIVE) {
1195
                        if ($userRedirect && $userRedirect->status == User::STATUS_ACTIVE) {
Línea 1228... Línea 1243...
1228
 
1243
 
Línea -... Línea 1244...
-
 
1244
 
-
 
1245
                                $this->cache->removeItem('user_share_invitation');
-
 
1246
 
-
 
1247
 
-
 
1248
                         
-
 
1249
                                if($content_type == 'feed') {
-
 
1250
                                    $url = $this->url()->fromRoute('dashboard', ['feed' => $content_uuid ]);
-
 
1251
                                    
-
 
1252
                                }
-
 
1253
                                else if($content_type == 'post') {
-
 
1254
                                    $url = $this->url()->fromRoute('post', ['id' => $content_uuid ]);
-
 
1255
                                }
-
 
1256
                                else {
-
 
1257
                                    $url = $this->url()->fromRoute('dashboard');
-
 
1258
                                }
-
 
1259
                                
-
 
1260
                                $hostname = empty($_SERVER['HTTP_HOST']) ?  '' : $_SERVER['HTTP_HOST'];
-
 
1261
                                
-
 
1262
                                $networkMapper = NetworkMapper::getInstance($this->adapter);
-
 
1263
                                $network = $networkMapper->fetchOneByHostnameForFrontend($hostname);
-
 
1264
                                
-
 
1265
                                if(!$network) {
-
 
1266
                                    $network = $networkMapper->fetchOneByDefault();
-
 
1267
                                }
Línea 1229... Línea 1268...
1229
 
1268
                                
1230
                                $this->cache->removeItem('user_share_invitation');
1269
                                $hostname = trim($network->main_hostname);
1231
 
1270
                                $url = 'https://' . $hostname . $url;
1232
 
1271
                                
Línea 1233... Línea 1272...
1233
 
1272