Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 1 Rev 3639
Línea 37... Línea 37...
37
use Nullix\CryptoJsAes\CryptoJsAes;
37
use Nullix\CryptoJsAes\CryptoJsAes;
38
use LeadersLinked\Model\UserPassword;
38
use LeadersLinked\Model\UserPassword;
39
use LeadersLinked\Mapper\CompanyMapper;
39
use LeadersLinked\Mapper\CompanyMapper;
40
use LeadersLinked\Mapper\CompanyUserMapper;
40
use LeadersLinked\Mapper\CompanyUserMapper;
41
use LeadersLinked\Model\CompanyUser;
41
use LeadersLinked\Model\CompanyUser;
-
 
42
use LeadersLinked\Mapper\NetworkMapper;
Línea 42... Línea 43...
42
 
43
 
43
 
44
 
44
class BackendController extends AbstractActionController
45
class BackendController extends AbstractActionController
Línea 92... Línea 93...
92
        $request = $this->getRequest();
93
        $request = $this->getRequest();
93
        if($request->isGet()) {
94
        if($request->isGet()) {
94
            $currentUserPlugin = $this->plugin('currentUserPlugin');
95
            $currentUserPlugin = $this->plugin('currentUserPlugin');
95
            $currentUser = $currentUserPlugin->getUser();
96
            $currentUser = $currentUserPlugin->getUser();
Línea -... Línea 97...
-
 
97
            
-
 
98
            $networkMapper = NetworkMapper::getInstance($this->adapter);
-
 
99
            $network = $networkMapper->fetchOne($currentUser->network_id);
-
 
100
            
-
 
101
            $sandbox = $this->config['leaderslinked.runmode.sandbox'];
-
 
102
            if($sandbox) {
-
 
103
                $salt = $this->config['leaderslinked.backend.sandbox_salt'];
-
 
104
            } else {
-
 
105
                $salt = $this->config['leaderslinked.backend.production_salt'];
-
 
106
            }
-
 
107
            
Línea 96... Línea 108...
96
            
108
            
Línea 97... Línea 109...
97
            
109
            
Línea 105... Línea 117...
105
                    
117
                    
106
                    $userMapper = UserMapper::getInstance($this->adapter);
118
                    $userMapper = UserMapper::getInstance($this->adapter);
107
                    $userMapper->updateOneTimePassword($currentUser, $one_time_password);
119
                    $userMapper->updateOneTimePassword($currentUser, $one_time_password);
Línea 108... Línea -...
108
                }
-
 
109
                
-
 
110
                $sandbox = $this->config['leaderslinked.runmode.sandbox'];
-
 
111
                if($sandbox) {
-
 
112
                    $url = $this->config['leaderslinked.backend.sandbox_url'];
-
 
113
                    $salt = $this->config['leaderslinked.backend.sandbox_salt'];
-
 
114
                } else {
-
 
115
                    $url = $this->config['leaderslinked.backend.production_url'];
-
 
-
 
120
                }
Línea 116... Línea 121...
116
                    $salt = $this->config['leaderslinked.backend.production_salt'];
121
                
117
                }
122
 
118
                
123
                
Línea 126... Línea 131...
126
                    'password' => $password,
131
                    'password' => $password,
127
                    'rand' => $rand,
132
                    'rand' => $rand,
128
                    'time' => $timestamp,
133
                    'time' => $timestamp,
129
                ];
134
                ];
Línea 130... Línea 135...
130
                
135
                
131
                $link_admin = $url . '/signin-admin' . '?' . http_build_query($params);
136
                $link_admin = 'https://'. $network->admin_hostname . '/signin-admin' . '?' . http_build_query($params);
132
            } else {
137
            } else {
133
                $link_admin = '';
138
                $link_admin = '';
Línea 134... Línea 139...
134
            }
139
            }
Línea 161... Línea 166...
161
        if($request->isGet()) {
166
        if($request->isGet()) {
Línea 162... Línea 167...
162
           
167
           
163
            
168
            
-
 
169
            $currentUserPlugin = $this->plugin('currentUserPlugin');
Línea 164... Línea 170...
164
            $currentUserPlugin = $this->plugin('currentUserPlugin');
170
            $currentUser = $currentUserPlugin->getUser();
165
            $currentUser = $currentUserPlugin->getUser();
171
 
166
            
172
            
Línea 167... Línea 173...
167
            $id = $this->params()->fromRoute('id');
173
            $id = $this->params()->fromRoute('id');
Línea 168... Línea 174...
168
            $companyMapper = CompanyMapper::getInstance($this->adapter);
174
            $companyMapper = CompanyMapper::getInstance($this->adapter);
Línea -... Línea 175...
-
 
175
            $company = $companyMapper->fetchOneByUuid($id);
-
 
176
            
-
 
177
            $link_admin = '';
169
            $company = $companyMapper->fetchOneByUuid($id);
178
            
170
            
179
            if($company) {
Línea 171... Línea 180...
171
            $link_admin = '';
180
                
172
            
181
                $networkMapper = NetworkMapper::getInstance($this->adapter);
Línea 183... Línea 192...
183
                        
192
                        
184
                        $userMapper = UserMapper::getInstance($this->adapter);
193
                        $userMapper = UserMapper::getInstance($this->adapter);
185
                        $userMapper->updateOneTimePassword($currentUser, $one_time_password);
194
                        $userMapper->updateOneTimePassword($currentUser, $one_time_password);
Línea 186... Línea -...
186
                    }
-
 
187
                    
-
 
188
                    $timestamp = date('Y-m-d\TH:i:s');
-
 
189
                    $rand = 1000 + rand(1, 8999);
-
 
Línea 190... Línea 195...
190
                    
195
                    }
191
                    
196
                    
192
                    
-
 
193
                    $sandbox = $this->config['leaderslinked.runmode.sandbox'];
197
                    
194
                    if($sandbox) {
198
                    $sandbox = $this->config['leaderslinked.runmode.sandbox'];
195
                        $url = $this->config['leaderslinked.backend.sandbox_url'];
-
 
196
                        $salt = $this->config['leaderslinked.backend.sandbox_salt'];
199
                    if($sandbox) {
197
                    } else {
200
                        $salt = $this->config['leaderslinked.backend.sandbox_salt'];
Línea -... Línea 201...
-
 
201
                    } else {
-
 
202
                        $salt = $this->config['leaderslinked.backend.production_salt'];
-
 
203
                    }
-
 
204
                    
-
 
205
                    
198
                        $url = $this->config['leaderslinked.backend.production_url'];
206
                    $timestamp = date('Y-m-d\TH:i:s');
199
                        $salt = $this->config['leaderslinked.backend.production_salt'];
207
                    $rand = 1000 + rand(1, 8999);
200
                    }
208
     
Línea -... Línea 209...
-
 
209
                    
201
                    
210
                    
202
                    
211
                    $rand = 1000 + mt_rand(1, 999);
-
 
212
                    $timestamp = time();
-
 
213
                    $password = md5($currentUser->one_time_password . '-' . $rand . '-' . $timestamp . '-' . $salt);
203
                    $rand = 1000 + mt_rand(1, 999);
214
                    
-
 
215
                    $params = [
Línea -... Línea 216...
-
 
216
                        'user_uuid' => $currentUser->uuid,
204
                    $timestamp = time();
217
                        'password' => $password,
Línea 205... Línea 218...
205
                    $password = md5($currentUser->one_time_password . '-' . $rand . '-' . $timestamp . '-' . $salt);
218
                        'rand' => $rand,