Proyectos de Subversion LeadersLinked - Services

Rev

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

Rev 155 Rev 177
Línea 1818... Línea 1818...
1818
            'success' => false,
1818
            'success' => false,
1819
            'data' => 'ERROR_METHOD_NOT_ALLOWED'
1819
            'data' => 'ERROR_METHOD_NOT_ALLOWED'
1820
        ]);
1820
        ]);
1821
    }
1821
    }
Línea 1822... Línea 1822...
1822
    
1822
    
1823
    public function autologinAction()
1823
    public function debugAction()
1824
    {
1824
    {
1825
        $email = 'santiago.olivera@leaderslinked.com';
1825
        $currentNetworkPlugin = $this->plugin('currentNetworkPlugin');
Línea 1826... Línea -...
1826
        $network_id = 1;
-
 
1827
        
1826
        $currentNetwork = $currentNetworkPlugin->getNetwork();
Línea -... Línea 1827...
-
 
1827
        
-
 
1828
        $request = $this->getRequest();
-
 
1829
        
-
 
1830
        if ($request->isPost()) {
-
 
1831
            $currentNetworkPlugin = $this->plugin('currentNetworkPlugin');
-
 
1832
            $currentNetwork = $currentNetworkPlugin->getNetwork();
-
 
1833
            
-
 
1834
            $jwtToken = null;
-
 
1835
            $headers = getallheaders();
-
 
1836
            
-
 
1837
            
-
 
1838
            if(!empty($headers['authorization']) || !empty($headers['Authorization'])) {
-
 
1839
                
-
 
1840
                $token = trim(empty($headers['authorization']) ? $headers['Authorization'] : $headers['authorization']);
-
 
1841
                
-
 
1842
                
-
 
1843
                if (substr($token, 0, 6 ) == 'Bearer') {
-
 
1844
                    
-
 
1845
                    $token = trim(substr($token, 7));
-
 
1846
                    
-
 
1847
                    if(!empty($this->config['leaderslinked.jwt.key'])) {
-
 
1848
                        $key = $this->config['leaderslinked.jwt.key'];
-
 
1849
                        
-
 
1850
                        
-
 
1851
                        try {
-
 
1852
                            $payload = JWT::decode($token, new Key($key, 'HS256'));
-
 
1853
                            
-
 
1854
                            
-
 
1855
                            if(empty($payload->iss) || $payload->iss != $_SERVER['HTTP_HOST']) {
-
 
1856
                                return new JsonModel(['success' => false, 'data' => 'Unauthorized - JWT - Wrong server',  'fatal'  => true]);
-
 
1857
                            }
-
 
1858
                            
-
 
1859
                            $uuid = empty($payload->uuid) ? '' : $payload->uuid;
-
 
1860
                            $jwtTokenMapper = JwtTokenMapper::getInstance($this->adapter);
-
 
1861
                            $jwtToken = $jwtTokenMapper->fetchOneByUuid($uuid);
-
 
1862
                            if(!$jwtToken) {
-
 
1863
                                return new JsonModel(['success' => false, 'data' => 'Unauthorized - JWT - Expired',  'fatal'  => true]);
-
 
1864
                            }
-
 
1865
                            
-
 
1866
                        } catch(\Exception $e) {
-
 
1867
                            return new JsonModel(['success' => false, 'data' => 'Unauthorized - JWT - Wrong key',  'fatal'  => true]);
-
 
1868
                        }
-
 
1869
                    } else {
-
 
1870
                        return new JsonModel(['success' => false, 'data' => 'Unauthorized - JWT - SecreteKey required',  'fatal'  => true]);
-
 
1871
                    }
-
 
1872
                } else {
-
 
1873
                    return new JsonModel(['success' => false, 'data' => 'Unauthorized - JWT - Bearer required',  'fatal'  => true]);
-
 
1874
                }
-
 
1875
            } else {
-
 
1876
                return new JsonModel(['success' => false, 'data' => 'Unauthorized - JWT - Required',  'fatal'  => true]);
-
 
1877
            }
-
 
1878
            
-
 
1879
            
-
 
1880
            $form = new  SigninForm($this->config);
-
 
1881
            $dataPost = $request->getPost()->toArray();
-
 
1882
 
-
 
1883
            
-
 
1884
            $form->setData($dataPost);
-
 
1885
            
-
 
1886
            if ($form->isValid()) {
-
 
1887
                
-
 
1888
                $dataPost = (array) $form->getData();
-
 
1889
                
-
 
1890
                $email      = $dataPost['email'];
-
 
1891
                $password   = $dataPost['password'];
-
 
1892
 
-
 
1893
                
-
 
1894
                
-
 
1895
                
1828
        $authAdapter = new AuthEmailAdapter($this->adapter);
1896
                
-
 
1897
                $authAdapter = new AuthAdapter($this->adapter, $this->logger);
1829
        $authAdapter->setData($email, $network_id);
1898
                $authAdapter->setData($email, $password, $currentNetwork->id);
-
 
1899
                $authService = new AuthenticationService();
-
 
1900
                
-
 
1901
                $result = $authService->authenticate($authAdapter);
-
 
1902
                
-
 
1903
                if ($result->getCode() == AuthResult::SUCCESS) {
-
 
1904
                    
-
 
1905
                    $identity = $result->getIdentity();
-
 
1906
                    
-
 
1907
                    
-
 
1908
                    $userMapper = UserMapper::getInstance($this->adapter);
-
 
1909
                    $user = $userMapper->fetchOne($identity['user_id']);
-
 
1910
                    
-
 
1911
                    
-
 
1912
                    if($token) {
-
 
1913
                        $jwtToken->user_id = $user->id;
-
 
1914
                        $jwtTokenMapper = JwtTokenMapper::getInstance($this->adapter);
-
 
1915
                        $jwtTokenMapper->update($jwtToken);
-
 
1916
                    }
-
 
1917
                    
-
 
1918
                    
-
 
1919
                    $navigator = get_browser(null, true);
-
 
1920
                    $device_type    =  isset($navigator['device_type']) ? $navigator['device_type'] : '';
-
 
1921
                    $platform       =  isset($navigator['platform']) ? $navigator['platform'] : '';
-
 
1922
                    $browser        =  isset($navigator['browser']) ? $navigator['browser'] : '';
-
 
1923
                    
-
 
1924
                    
-
 
1925
                    $istablet = isset($navigator['istablet']) ?  intval($navigator['istablet']) : 0;
-
 
1926
                    $ismobiledevice = isset($navigator['ismobiledevice']) ? intval($navigator['ismobiledevice']) : 0;
-
 
1927
                    $version = isset($navigator['version']) ? $navigator['version'] : '';
-
 
1928
                    
-
 
1929
                    
-
 
1930
                    $userBrowserMapper = UserBrowserMapper::getInstance($this->adapter);
-
 
1931
                    $userBrowser = $userBrowserMapper->fetch($user->id, $device_type, $platform, $browser);
-
 
1932
                    if ($userBrowser) {
-
 
1933
                        $userBrowserMapper->update($userBrowser);
-
 
1934
                    } else {
-
 
1935
                        $userBrowser = new UserBrowser();
-
 
1936
                        $userBrowser->user_id           = $user->id;
-
 
1937
                        $userBrowser->browser           = $browser;
-
 
1938
                        $userBrowser->platform          = $platform;
-
 
1939
                        $userBrowser->device_type       = $device_type;
-
 
1940
                        $userBrowser->is_tablet         = $istablet;
-
 
1941
                        $userBrowser->is_mobile_device  = $ismobiledevice;
-
 
1942
                        $userBrowser->version           = $version;
-
 
1943
                        
-
 
1944
                        $userBrowserMapper->insert($userBrowser);
-
 
1945
                    }
-
 
1946
                    //
1830
        
1947
                    
-
 
1948
                    $ip = Functions::getUserIP();
-
 
1949
                    $ip = $ip == '127.0.0.1' ? '148.240.211.148' : $ip;
-
 
1950
                    
1831
        $authService = new AuthenticationService();
1951
                    $userIpMapper = UserIpMapper::getInstance($this->adapter);
-
 
1952
                    $userIp = $userIpMapper->fetch($user->id, $ip);
-
 
1953
                    if (empty($userIp)) {
-
 
1954
                        
-
 
1955
                        if ($this->config['leaderslinked.runmode.sandbox']) {
-
 
1956
                            $filename = $this->config['leaderslinked.geoip2.production_database'];
-
 
1957
                        } else {
-
 
1958
                            $filename = $this->config['leaderslinked.geoip2.sandbox_database'];
-
 
1959
                        }
-
 
1960
                        
-
 
1961
                        $reader = new GeoIp2Reader($filename); //GeoIP2-City.mmdb');
-
 
1962
                        $record = $reader->city($ip);
-
 
1963
                        if ($record) {
-
 
1964
                            $userIp = new UserIp();
-
 
1965
                            $userIp->user_id = $user->id;
-
 
1966
                            $userIp->city = !empty($record->city->name) ? Functions::utf8_decode($record->city->name) : '';
-
 
1967
                            $userIp->state_code = !empty($record->mostSpecificSubdivision->isoCode) ? Functions::utf8_decode($record->mostSpecificSubdivision->isoCode) : '';
-
 
1968
                            $userIp->state_name = !empty($record->mostSpecificSubdivision->name) ? Functions::utf8_decode($record->mostSpecificSubdivision->name) : '';
-
 
1969
                            $userIp->country_code = !empty($record->country->isoCode) ? Functions::utf8_decode($record->country->isoCode) : '';
-
 
1970
                            $userIp->country_name = !empty($record->country->name) ? Functions::utf8_decode($record->country->name) : '';
-
 
1971
                            $userIp->ip = $ip;
-
 
1972
                            $userIp->latitude = !empty($record->location->latitude) ? $record->location->latitude : 0;
-
 
1973
                            $userIp->longitude = !empty($record->location->longitude) ? $record->location->longitude : 0;
-
 
1974
                            $userIp->postal_code = !empty($record->postal->code) ? $record->postal->code : '';
-
 
1975
                            
-
 
1976
                            $userIpMapper->insert($userIp);
-
 
1977
                        }
-
 
1978
                    } else {
-
 
1979
                        $userIpMapper->update($userIp);
-
 
1980
                    }
-
 
1981
                    
-
 
1982
                    /*
-
 
1983
                     if ($remember) {
-
 
1984
                     $expired = time() + 365 * 24 * 60 * 60;
-
 
1985
                     
-
 
1986
                     $cookieEmail = new SetCookie('email', $email, $expired);
-
 
1987
                     } else {
-
 
1988
                     $expired = time() - 7200;
-
 
1989
                     $cookieEmail = new SetCookie('email', '', $expired);
1832
        $result = $authService->authenticate($authAdapter);
1990
                     }
-
 
1991
                     
-
 
1992
                     
-
 
1993
                     $response = $this->getResponse();
-
 
1994
                     $response->getHeaders()->addHeader($cookieEmail);
-
 
1995
                     */
-
 
1996
                    
-
 
1997
                    
-
 
1998
                    
-
 
1999
                    
-
 
2000
                    
-
 
2001
                    $this->logger->info('Ingreso a LeadersLiked', ['user_id' => $user->id, 'ip' => Functions::getUserIP()]);
-
 
2002
                    
-
 
2003
                    $user_share_invitation = $this->cache->getItem('user_share_invitation');
-
 
2004
                    
-
 
2005
                    if ($user_share_invitation) {
-
 
2006
                        $userRedirect = $userMapper->fetchOneByUuid($user_share_invitation);
-
 
2007
                        if ($userRedirect && $userRedirect->status == User::STATUS_ACTIVE && $user->id != $userRedirect->id) {
-
 
2008
                            $connectionMapper = ConnectionMapper::getInstance($this->adapter);
-
 
2009
                            $connection = $connectionMapper->fetchOneByUserId1AndUserId2($user->id, $userRedirect->id);
-
 
2010
                            
-
 
2011
                            if ($connection) {
-
 
2012
                                
-
 
2013
                                if ($connection->status != Connection::STATUS_ACCEPTED) {
-
 
2014
                                    $connectionMapper->approve($connection);
-
 
2015
                                }
-
 
2016
                            } else {
-
 
2017
                                $connection = new Connection();
-
 
2018
                                $connection->request_from = $user->id;
-
 
2019
                                $connection->request_to = $userRedirect->id;
-
 
2020
                                $connection->status = Connection::STATUS_ACCEPTED;
-
 
2021
                                
-
 
2022
                                $connectionMapper->insert($connection);
-
 
2023
                            }
-
 
2024
                        }
-
 
2025
                    }
-
 
2026
                    
-
 
2027
                    
1833
        
2028
                    
-
 
2029
                    $data = [
-
 
2030
                        'success'   => true,
-
 
2031
                        'data'      => $this->url()->fromRoute('dashboard'),
-
 
2032
                    ];
-
 
2033
                    
-
 
2034
                    $this->cache->removeItem('user_share_invitation');
-
 
2035
                } else {
-
 
2036
                    
-
 
2037
                    $message = $result->getMessages()[0];
-
 
2038
                    if (!in_array($message, [
-
 
2039
                        'ERROR_USER_NOT_FOUND', 'ERROR_USER_EMAIL_HASNT_BEEN_VARIFIED', 'ERROR_USER_IS_BLOCKED',
-
 
2040
                        'ERROR_USER_IS_INACTIVE', 'ERROR_ENTERED_PASS_INCORRECT_USER_IS_BLOCKED', 'ERROR_ENTERED_PASS_INCORRECT_2',
-
 
2041
                        'ERROR_ENTERED_PASS_INCORRECT_1', 'ERROR_USER_REQUEST_ACCESS_IS_PENDING', 'ERROR_USER_REQUEST_ACCESS_IS_REJECTED'
-
 
2042
                        
-
 
2043
                        
-
 
2044
                    ])) {
-
 
2045
                    }
-
 
2046
                    
-
 
2047
                    switch ($message) {
-
 
2048
                        case 'ERROR_USER_NOT_FOUND':
-
 
2049
                            $this->logger->err('Error de ingreso a LeadersLinked de ' . $email . ' - Email no existe', ['ip' => Functions::getUserIP()]);
-
 
2050
                            break;
-
 
2051
                            
-
 
2052
                        case 'ERROR_USER_EMAIL_HASNT_BEEN_VARIFIED':
-
 
2053
                            $this->logger->err('Error de ingreso a LeadersLinked de ' . $email . ' - Email no verificado', ['ip' => Functions::getUserIP()]);
-
 
2054
                            break;
-
 
2055
                            
-
 
2056
                        case 'ERROR_USER_IS_BLOCKED':
-
 
2057
                            $this->logger->err('Error de ingreso a LeadersLinked de ' . $email . ' - Usuario bloqueado', ['ip' => Functions::getUserIP()]);
-
 
2058
                            break;
-
 
2059
                            
-
 
2060
                        case 'ERROR_USER_IS_INACTIVE':
-
 
2061
                            $this->logger->err('Error de ingreso a LeadersLinked de ' . $email . ' - Usuario inactivo', ['ip' => Functions::getUserIP()]);
-
 
2062
                            break;
-
 
2063
                            
-
 
2064
                            
-
 
2065
                        case 'ERROR_ENTERED_PASS_INCORRECT_USER_IS_BLOCKED':
-
 
2066
                            $this->logger->err('Error de ingreso a LeadersLinked de ' . $email . ' - 3er Intento Usuario bloqueado', ['ip' => Functions::getUserIP()]);
-
 
2067
                            break;
-
 
2068
                            
-
 
2069
                            
-
 
2070
                        case 'ERROR_ENTERED_PASS_INCORRECT_2':
-
 
2071
                            $this->logger->err('Error de ingreso a LeadersLinked de ' . $email . ' - 1er Intento', ['ip' => Functions::getUserIP()]);
-
 
2072
                            break;
-
 
2073
                            
-
 
2074
                            
-
 
2075
                        case 'ERROR_ENTERED_PASS_INCORRECT_1':
-
 
2076
                            $this->logger->err('Error de ingreso a LeadersLinked de ' . $email . ' - 2do Intento', ['ip' => Functions::getUserIP()]);
-
 
2077
                            break;
-
 
2078
                            
-
 
2079
                            
-
 
2080
                        case 'ERROR_USER_REQUEST_ACCESS_IS_PENDING':
-
 
2081
                            $this->logger->err('Error de ingreso a LeadersLinked de ' . $email . ' - Falta verificar que pertence a la Red Privada', ['ip' => Functions::getUserIP()]);
-
 
2082
                            break;
-
 
2083
                            
-
 
2084
                        case  'ERROR_USER_REQUEST_ACCESS_IS_REJECTED':
-
 
2085
                            $this->logger->err('Error de ingreso a LeadersLinked de ' . $email . ' - Rechazado por no pertence a la Red Privada', ['ip' => Functions::getUserIP()]);
-
 
2086
                            break;
-
 
2087
                            
-
 
2088
                            
-
 
2089
                        default:
-
 
2090
                            $message = 'ERROR_UNKNOWN';
-
 
2091
                            $this->logger->err('Error de ingreso a LeadersLinked de ' . $email . ' - Error desconocido', ['ip' => Functions::getUserIP()]);
-
 
2092
                            break;
-
 
2093
                    }
-
 
2094
                    
-
 
2095
                    
-
 
2096
                    
-
 
2097
                    
-
 
2098
                    $data = [
-
 
2099
                        'success'   => false,
-
 
2100
                        'data'   => $message
-
 
2101
                    ];
-
 
2102
                }
-
 
2103
                
-
 
2104
                return new JsonModel($data);
-
 
2105
            } else {
-
 
2106
                $messages = [];
-
 
2107
                
-
 
2108
                
-
 
2109
                
-
 
2110
                $form_messages = (array) $form->getMessages();
-
 
2111
                foreach ($form_messages  as $fieldname => $field_messages) {
-
 
2112
                    
-
 
2113
                    $messages[$fieldname] = array_values($field_messages);
-
 
2114
                }
-
 
2115
                
-
 
2116
                return new JsonModel([
-
 
2117
                    'success'   => false,
-
 
2118
                    'data'   => $messages
-
 
2119
                ]);
-
 
2120
            }
-
 
2121
        } else if ($request->isGet()) {
-
 
2122
            
-
 
2123
            $aes = '';
-
 
2124
            $jwtToken = null;
-
 
2125
            $headers = getallheaders();
-
 
2126
            
-
 
2127
            
-
 
2128
            if(!empty($headers['authorization']) || !empty($headers['Authorization'])) {
-
 
2129
                
-
 
2130
                $token = trim(empty($headers['authorization']) ? $headers['Authorization'] : $headers['authorization']);
-
 
2131
                
-
 
2132
                
-
 
2133
                if (substr($token, 0, 6 ) == 'Bearer') {
-
 
2134
                    
-
 
2135
                    $token = trim(substr($token, 7));
-
 
2136
                    
-
 
2137
                    if(!empty($this->config['leaderslinked.jwt.key'])) {
-
 
2138
                        $key = $this->config['leaderslinked.jwt.key'];
-
 
2139
                        
-
 
2140
                        
-
 
2141
                        try {
-
 
2142
                            $payload = JWT::decode($token, new Key($key, 'HS256'));
-
 
2143
                            
-
 
2144
                            
-
 
2145
                            if(empty($payload->iss) || $payload->iss != $_SERVER['HTTP_HOST']) {
-
 
2146
                                return new JsonModel(['success' => false, 'data' => 'Unauthorized - JWT - Wrong server',  'fatal'  => true]);
-
 
2147
                            }
-
 
2148
                            
-
 
2149
                            $uuid = empty($payload->uuid) ? '' : $payload->uuid;
-
 
2150
                            $jwtTokenMapper = JwtTokenMapper::getInstance($this->adapter);
-
 
2151
                            $jwtToken = $jwtTokenMapper->fetchOneByUuid($uuid);
-
 
2152
                        } catch(\Exception $e) {
-
 
2153
                            //Token invalido
-
 
2154
                        }
-
 
2155
                    }
-
 
2156
                }
-
 
2157
            }
-
 
2158
            
-
 
2159
            if(!$jwtToken) {
-
 
2160
                
-
 
2161
                $aes = Functions::generatePassword(16);
-
 
2162
                
-
 
2163
                $jwtToken = new JwtToken();
-
 
2164
                $jwtToken->aes = $aes;
-
 
2165
                
-
 
2166
                $jwtTokenMapper = JwtTokenMapper::getInstance($this->adapter);
-
 
2167
                if($jwtTokenMapper->insert($jwtToken)) {
-
 
2168
                    $jwtToken = $jwtTokenMapper->fetchOne($jwtToken->id);
-
 
2169
                }
-
 
2170
                
-
 
2171
                $token = '';
-
 
2172
                
-
 
2173
                if(!empty($this->config['leaderslinked.jwt.key'])) {
-
 
2174
                    $issuedAt   = new \DateTimeImmutable();
-
 
2175
                    $expire     = $issuedAt->modify('+24 hours')->getTimestamp();
-
 
2176
                    $serverName = $_SERVER['HTTP_HOST'];
-
 
2177
                    $payload = [
-
 
2178
                        'iat'  => $issuedAt->getTimestamp(),
-
 
2179
                        'iss'  => $serverName,
-
 
2180
                        'nbf'  => $issuedAt->getTimestamp(),
-
 
2181
                        'exp'  => $expire,
-
 
2182
                        'uuid' => $jwtToken->uuid,
-
 
2183
                    ];
-
 
2184
                    
-
 
2185
                    
-
 
2186
                    $key = $this->config['leaderslinked.jwt.key'];
-
 
2187
                    $token = JWT::encode($payload, $key, 'HS256');
-
 
2188
                }
-
 
2189
            }
-
 
2190
            
-
 
2191
            
-
 
2192
            
-
 
2193
            
-
 
2194
            
-
 
2195
            
-
 
2196
            
-
 
2197
            if ($this->config['leaderslinked.runmode.sandbox']) {
-
 
2198
                $site_key      = $this->config['leaderslinked.google_captcha.sandbox_site_key'];
-
 
2199
            } else {
-
 
2200
                $site_key      = $this->config['leaderslinked.google_captcha.production_site_key'];
-
 
2201
            }
-
 
2202
            
-
 
2203
            
-
 
2204
            $access_usign_social_networks = $this->config['leaderslinked.runmode.access_usign_social_networks'];
-
 
2205
            
-
 
2206
            $sandbox = $this->config['leaderslinked.runmode.sandbox'];
-
 
2207
            if ($sandbox) {
-
 
2208
                $google_map_key  = $this->config['leaderslinked.google_map.sandbox_api_key'];
-
 
2209
            } else {
-
 
2210
                $google_map_key  = $this->config['leaderslinked.google_map.production_api_key'];
-
 
2211
            }
-
 
2212
            
-
 
2213
            
-
 
2214
            
-
 
2215
            
-
 
2216
            $logo_url = $this->url()->fromRoute('storage-network', ['type' => 'logo'],['force_canonical' => true]);
-
 
2217
            $logo_url = str_replace($currentNetwork->main_hostname, $currentNetwork->service_hostname, $logo_url);
-
 
2218
            if($currentNetwork->alternative_hostname) {
-
 
2219
                $logo_url = str_replace($currentNetwork->alternative_hostname, $currentNetwork->service_hostname, $logo_url);
-
 
2220
                
-
 
2221
            }
-
 
2222
            
-
 
2223
            
-
 
2224
            $navbar_url = $this->url()->fromRoute('storage-network', ['type' => 'navbar'],['force_canonical' => true]);
-
 
2225
            $navbar_url = str_replace($currentNetwork->main_hostname, $currentNetwork->service_hostname, $navbar_url);
-
 
2226
            if($currentNetwork->alternative_hostname) {
-
 
2227
                $navbar_url = str_replace($currentNetwork->alternative_hostname, $currentNetwork->service_hostname, $navbar_url);
-
 
2228
                
-
 
2229
            }
-
 
2230
            
-
 
2231
            
-
 
2232
            $favico_url= $this->url()->fromRoute('storage-network', ['type' => 'favico'],['force_canonical' => true]);
-
 
2233
            $favico_url = str_replace($currentNetwork->main_hostname, $currentNetwork->service_hostname, $favico_url);
-
 
2234
            if($currentNetwork->alternative_hostname) {
-
 
2235
                $favico_url = str_replace($currentNetwork->alternative_hostname, $currentNetwork->service_hostname, $favico_url);
-
 
2236
                
-
 
2237
            }
-
 
2238
            
-
 
2239
            
-
 
2240
            
-
 
2241
            $data = [
-
 
2242
                'google_map_key'                => $google_map_key,
-
 
2243
                'email'                         => '',
-
 
2244
                'remember'                      => false,
-
 
2245
                'site_key'                      => $site_key,
-
 
2246
                'theme_id'                      => $currentNetwork->theme_id,
-
 
2247
                'aes'                           => $aes,
-
 
2248
                'jwt'                           => $token,
-
 
2249
                'defaultNetwork'                => $currentNetwork->default,
-
 
2250
                'access_usign_social_networks'  => $access_usign_social_networks && $currentNetwork->default == Network::DEFAULT_YES ? 'y' : 'n',
-
 
2251
                'logo_url'                      => $logo_url,
-
 
2252
                'navbar_url'                    => $navbar_url,
-
 
2253
                'favico_url'                    => $favico_url,
-
 
2254
                'intro'                         => $currentNetwork->intro ? $currentNetwork->intro : '',
-
 
2255
                'is_logged_in'                  => $jwtToken->user_id ? true : false,
-
 
2256
                
-
 
2257
            ];
-
 
2258
            
-
 
2259
            $data = [
-
 
2260
                'success' => true,
1834
        
2261
                'data' =>  $data
-
 
2262
            ];
-
 
2263
            
-
 
2264
        } else {
-
 
2265
            $data = [
-
 
2266
                'success' => false,
1835
        if ($result->getCode() == AuthResult::SUCCESS) {
2267
                'data' => 'ERROR_METHOD_NOT_ALLOWED'
1836
            return $this->redirect()->toRoute('dashboard');
2268
            ];
Línea -... Línea 2269...
-
 
2269
            
-
 
2270
            return new JsonModel($data);
Línea 1837... Línea 2271...
1837
        } else {
2271
        }
1838
            throw new \Exception($result->getMessages()[0]);
2272