@@ -171,8 +171,7 @@ |
||
| 171 | 171 | try |
| 172 | 172 | { |
| 173 | 173 | $data = (array) \Firebase\JWT\JWT::decode($token, env('JWT_SECRET'), ['HS256']); |
| 174 | - } |
|
| 175 | - catch(\RuntimeException $e) { |
|
| 174 | + } catch(\RuntimeException $e) { |
|
| 176 | 175 | $this->logout(); |
| 177 | 176 | |
| 178 | 177 | return null; |
@@ -90,12 +90,12 @@ discard block |
||
| 90 | 90 | { |
| 91 | 91 | $response = $this->client->request('login', compact('email', 'password', 'remember')); |
| 92 | 92 | |
| 93 | - if(!$this->client->success(true)) { |
|
| 93 | + if (!$this->client->success(true)) { |
|
| 94 | 94 | $this->lastError = Arr::get($response, 'message'); |
| 95 | 95 | return false; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - if(!$this->token = $this->client->getToken()) { |
|
| 98 | + if (!$this->token = $this->client->getToken()) { |
|
| 99 | 99 | return false; |
| 100 | 100 | } |
| 101 | 101 | |
@@ -122,11 +122,11 @@ discard block |
||
| 122 | 122 | { |
| 123 | 123 | $this->client->request('unsafeLogin', compact('email', 'remember')); |
| 124 | 124 | |
| 125 | - if(!$this->client->success()) { |
|
| 125 | + if (!$this->client->success()) { |
|
| 126 | 126 | return false; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - if(!$this->token = $this->client->getToken()) { |
|
| 129 | + if (!$this->token = $this->client->getToken()) { |
|
| 130 | 130 | return false; |
| 131 | 131 | } |
| 132 | 132 | |
@@ -145,13 +145,13 @@ discard block |
||
| 145 | 145 | // If we've already retrieved the user for the current request we can just |
| 146 | 146 | // return it back immediately. We do not want to fetch the user data on |
| 147 | 147 | // every call to this method because that would be tremendously slow. |
| 148 | - if (! is_null($this->user)) { |
|
| 148 | + if (!is_null($this->user)) { |
|
| 149 | 149 | return $this->user; |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | $user = null; |
| 153 | 153 | |
| 154 | - if($token = $this->token()) { |
|
| 154 | + if ($token = $this->token()) { |
|
| 155 | 155 | $user = $this->retrieveUserFromToken($token); |
| 156 | 156 | } |
| 157 | 157 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | */ |
| 166 | 166 | public function token() |
| 167 | 167 | { |
| 168 | - if($this->token) { |
|
| 168 | + if ($this->token) { |
|
| 169 | 169 | return $this->token; |
| 170 | 170 | } |
| 171 | 171 | |
@@ -214,13 +214,13 @@ discard block |
||
| 214 | 214 | { |
| 215 | 215 | $data = (array) \Firebase\JWT\JWT::decode($token, env('JWT_SECRET'), ['HS256']); |
| 216 | 216 | } |
| 217 | - catch(\RuntimeException $e) { |
|
| 217 | + catch (\RuntimeException $e) { |
|
| 218 | 218 | $this->logout(); |
| 219 | 219 | |
| 220 | 220 | return null; |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | - if(!$userId = Arr::get($data, 'userId')) { |
|
| 223 | + if (!$userId = Arr::get($data, 'userId')) { |
|
| 224 | 224 | return null; |
| 225 | 225 | } |
| 226 | 226 | |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | $messages = []; |
| 47 | 47 | |
| 48 | 48 | foreach (json_decode($message, true) as $property => $attributeMessages) { |
| 49 | - if(in_array($property, static::$attributeHides)) { |
|
| 49 | + if (in_array($property, static::$attributeHides)) { |
|
| 50 | 50 | continue; |
| 51 | 51 | } |
| 52 | 52 | |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function showResetForm(string $token, string $email) |
| 30 | 30 | { |
| 31 | - if(!$email = AuthService::validatePasswordResetToken($token, $email)) { |
|
| 31 | + if (!$email = AuthService::validatePasswordResetToken($token, $email)) { |
|
| 32 | 32 | throw new \Symfony\Component\HttpKernel\Exception\NotFoundHttpException(); |
| 33 | 33 | } |
| 34 | 34 | |
@@ -48,13 +48,13 @@ discard block |
||
| 48 | 48 | { |
| 49 | 49 | $this->validate($request, $this->rules(), $this->validationErrorMessages()); |
| 50 | 50 | |
| 51 | - if(AuthService::resetPassword( |
|
| 51 | + if (AuthService::resetPassword( |
|
| 52 | 52 | $request->input('token'), |
| 53 | 53 | $email = $request->input('email'), |
| 54 | 54 | $password = $request->input('password'), |
| 55 | 55 | $request->input('password_confirmation') |
| 56 | 56 | )) { |
| 57 | - if(AuthService::login($email, $password)) { |
|
| 57 | + if (AuthService::login($email, $password)) { |
|
| 58 | 58 | return $this->sendResetResponse(PasswordBroker::PASSWORD_RESET); |
| 59 | 59 | } |
| 60 | 60 | } |
@@ -262,8 +262,7 @@ discard block |
||
| 262 | 262 | |
| 263 | 263 | try { |
| 264 | 264 | $response = $this->client->request('me'); |
| 265 | - } |
|
| 266 | - catch(\Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException $e) { |
|
| 265 | + } catch(\Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException $e) { |
|
| 267 | 266 | return null; |
| 268 | 267 | } |
| 269 | 268 | |
@@ -345,8 +344,7 @@ discard block |
||
| 345 | 344 | |
| 346 | 345 | try { |
| 347 | 346 | $output = $callback(); |
| 348 | - } |
|
| 349 | - catch(\Exception $e) { |
|
| 347 | + } catch(\Exception $e) { |
|
| 350 | 348 | DB::rollBack(); |
| 351 | 349 | |
| 352 | 350 | if(is_null($fallback)) { |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | public function login(string $email, string $password, bool $remember = false) |
| 85 | 85 | { |
| 86 | - if($this->disabled()) { |
|
| 86 | + if ($this->disabled()) { |
|
| 87 | 87 | return $this->handleFallback('login', compact('email', 'password', 'remember')); |
| 88 | 88 | } |
| 89 | 89 | |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | public function unsafeLogin(string $email, bool $remember = false) |
| 107 | 107 | { |
| 108 | - if($this->disabled()) { |
|
| 108 | + if ($this->disabled()) { |
|
| 109 | 109 | return $this->handleFallback('unsafeLogin', compact('email', 'remember')); |
| 110 | 110 | } |
| 111 | 111 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | public function logout() |
| 123 | 123 | { |
| 124 | - if($this->disabled()) { |
|
| 124 | + if ($this->disabled()) { |
|
| 125 | 125 | return $this->handleFallback('logout'); |
| 126 | 126 | } |
| 127 | 127 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | public function register(int $userId, string $name, string $email, string $password, string $country) |
| 145 | 145 | { |
| 146 | - if($this->disabled()) { |
|
| 146 | + if ($this->disabled()) { |
|
| 147 | 147 | return []; |
| 148 | 148 | } |
| 149 | 149 | |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | */ |
| 162 | 162 | public function forgot(string $email) |
| 163 | 163 | { |
| 164 | - if($this->disabled()) { |
|
| 164 | + if ($this->disabled()) { |
|
| 165 | 165 | return $this->handleFallback('forgot', compact('email')); |
| 166 | 166 | } |
| 167 | 167 | |
@@ -182,13 +182,13 @@ discard block |
||
| 182 | 182 | */ |
| 183 | 183 | public function validatePasswordResetToken(string $token, string $email) |
| 184 | 184 | { |
| 185 | - if($this->disabled()) { |
|
| 185 | + if ($this->disabled()) { |
|
| 186 | 186 | return $this->handleFallback('validateReset', compact('token', 'email')); |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | $response = $this->client->request('validateReset', compact('token', 'email')); |
| 190 | 190 | |
| 191 | - if(!$this->client->success(true)) { |
|
| 191 | + if (!$this->client->success(true)) { |
|
| 192 | 192 | return false; |
| 193 | 193 | } |
| 194 | 194 | |
@@ -211,13 +211,13 @@ discard block |
||
| 211 | 211 | { |
| 212 | 212 | $parameters = compact('token', 'email', 'password', 'confirmation'); |
| 213 | 213 | |
| 214 | - if($this->disabled()) { |
|
| 214 | + if ($this->disabled()) { |
|
| 215 | 215 | return $this->handleFallback('resetPassword', $parameters); |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | $response = $this->client->request('reset', $parameters); |
| 219 | 219 | |
| 220 | - if(!$this->client->success(true)) { |
|
| 220 | + if (!$this->client->success(true)) { |
|
| 221 | 221 | return false; |
| 222 | 222 | } |
| 223 | 223 | |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | */ |
| 238 | 238 | public function update(int $id, ?string $name, ?string $email, ?string $password, ?string $country) |
| 239 | 239 | { |
| 240 | - if($this->disabled()) { |
|
| 240 | + if ($this->disabled()) { |
|
| 241 | 241 | return false; |
| 242 | 242 | } |
| 243 | 243 | |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | |
| 246 | 246 | $response = $this->client->request('update', compact('id', 'attributes')); |
| 247 | 247 | |
| 248 | - if(!$this->client->success(true)) { |
|
| 248 | + if (!$this->client->success(true)) { |
|
| 249 | 249 | return false; |
| 250 | 250 | } |
| 251 | 251 | |
@@ -261,13 +261,13 @@ discard block |
||
| 261 | 261 | */ |
| 262 | 262 | public function delete(int $id) |
| 263 | 263 | { |
| 264 | - if($this->disabled()) { |
|
| 264 | + if ($this->disabled()) { |
|
| 265 | 265 | return false; |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | $response = $this->client->request('delete', compact('id')); |
| 269 | 269 | |
| 270 | - if(!$this->client->success(true)) { |
|
| 270 | + if (!$this->client->success(true)) { |
|
| 271 | 271 | return false; |
| 272 | 272 | } |
| 273 | 273 | |
@@ -283,13 +283,13 @@ discard block |
||
| 283 | 283 | */ |
| 284 | 284 | public function restore(int $id) |
| 285 | 285 | { |
| 286 | - if($this->disabled()) { |
|
| 286 | + if ($this->disabled()) { |
|
| 287 | 287 | return false; |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | $response = $this->client->request('restore', compact('id')); |
| 291 | 291 | |
| 292 | - if(!$this->client->success(true)) { |
|
| 292 | + if (!$this->client->success(true)) { |
|
| 293 | 293 | return false; |
| 294 | 294 | } |
| 295 | 295 | |
@@ -303,18 +303,18 @@ discard block |
||
| 303 | 303 | */ |
| 304 | 304 | public function retrieveByToken() |
| 305 | 305 | { |
| 306 | - if($this->disabled()) { |
|
| 306 | + if ($this->disabled()) { |
|
| 307 | 307 | return null; |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | try { |
| 311 | 311 | $response = $this->client->request('me'); |
| 312 | 312 | } |
| 313 | - catch(\Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException $e) { |
|
| 313 | + catch (\Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException $e) { |
|
| 314 | 314 | return null; |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | - if(!$this->client->success(true)) { |
|
| 317 | + if (!$this->client->success(true)) { |
|
| 318 | 318 | return null; |
| 319 | 319 | } |
| 320 | 320 | |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | { |
| 349 | 349 | $handler = Str::camel(str_replace('.', ' ', $key)); |
| 350 | 350 | |
| 351 | - if(!method_exists($this->handlersContainer, $handler)) { |
|
| 351 | + if (!method_exists($this->handlersContainer, $handler)) { |
|
| 352 | 352 | throw new \InvalidArgumentException("Handler `{$handler}` cannot be found"); |
| 353 | 353 | } |
| 354 | 354 | |
@@ -388,11 +388,11 @@ discard block |
||
| 388 | 388 | { |
| 389 | 389 | $cache = new Cache(); |
| 390 | 390 | |
| 391 | - if(!func_num_args()) { |
|
| 391 | + if (!func_num_args()) { |
|
| 392 | 392 | return $cache; |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | - if(func_num_args() === 1) { |
|
| 395 | + if (func_num_args() === 1) { |
|
| 396 | 396 | return $cache->get($key); |
| 397 | 397 | } |
| 398 | 398 | |
@@ -412,11 +412,11 @@ discard block |
||
| 412 | 412 | { |
| 413 | 413 | $cache = new Cache(); |
| 414 | 414 | |
| 415 | - if(func_num_args() === 1) { |
|
| 415 | + if (func_num_args() === 1) { |
|
| 416 | 416 | return $cache->getUserParams($remoteId); |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | - if(func_num_args() === 2) { |
|
| 419 | + if (func_num_args() === 2) { |
|
| 420 | 420 | return $cache->getUserParam($remoteId, $key); |
| 421 | 421 | } |
| 422 | 422 | |
@@ -440,10 +440,10 @@ discard block |
||
| 440 | 440 | try { |
| 441 | 441 | $output = $callback(); |
| 442 | 442 | } |
| 443 | - catch(\Exception $e) { |
|
| 443 | + catch (\Exception $e) { |
|
| 444 | 444 | DB::rollBack(); |
| 445 | 445 | |
| 446 | - if(is_null($fallback)) { |
|
| 446 | + if (is_null($fallback)) { |
|
| 447 | 447 | throw $e; |
| 448 | 448 | } |
| 449 | 449 | |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | */ |
| 55 | 55 | public function getEncryptionKey() |
| 56 | 56 | { |
| 57 | - if(!$this->encryptionKey) { |
|
| 57 | + if (!$this->encryptionKey) { |
|
| 58 | 58 | return null; |
| 59 | 59 | } |
| 60 | 60 | |
@@ -196,8 +196,7 @@ |
||
| 196 | 196 | $foreigner, |
| 197 | 197 | $action = $foreigner->getRemoteAction() |
| 198 | 198 | ); |
| 199 | - } |
|
| 200 | - catch(\Slides\Connector\Auth\Exceptions\SyncException $e) { |
|
| 199 | + } catch(\Slides\Connector\Auth\Exceptions\SyncException $e) { |
|
| 201 | 200 | \Illuminate\Support\Facades\Log::error( |
| 202 | 201 | "Cannot $action the user {$foreigner->getEmail()}: " . $e->getMessage() |
| 203 | 202 | ); |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | */ |
| 159 | 159 | protected function parseResponse(array $response) |
| 160 | 160 | { |
| 161 | - $foreigners = array_map(function (array $user) { |
|
| 161 | + $foreigners = array_map(function(array $user) { |
|
| 162 | 162 | return $this->createRemoteUserFromResponse($user); |
| 163 | 163 | }, Arr::get($response, 'difference')); |
| 164 | 164 | |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | $action = $foreigner->getRemoteAction() |
| 199 | 199 | ); |
| 200 | 200 | } |
| 201 | - catch(\Slides\Connector\Auth\Exceptions\SyncException $e) { |
|
| 201 | + catch (\Slides\Connector\Auth\Exceptions\SyncException $e) { |
|
| 202 | 202 | \Illuminate\Support\Facades\Log::error( |
| 203 | 203 | "Cannot $action the user {$foreigner->getEmail()}: " . $e->getMessage() |
| 204 | 204 | ); |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | { |
| 364 | 364 | $output[] = $message; |
| 365 | 365 | |
| 366 | - if($this->outputCallback instanceof \Closure) { |
|
| 366 | + if ($this->outputCallback instanceof \Closure) { |
|
| 367 | 367 | call_user_func($this->outputCallback, $message); |
| 368 | 368 | } |
| 369 | 369 | } |
@@ -2,6 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | use Illuminate\Support\Facades\Route; |
| 4 | 4 | |
| 5 | -Route::group(['namespace' => 'Slides\Connector\Auth\Http\Controllers'], function () { |
|
| 5 | +Route::group(['namespace' => 'Slides\Connector\Auth\Http\Controllers'], function() { |
|
| 6 | 6 | Route::post('connector/webhook/{key}', 'WebhookController'); |
| 7 | 7 | }); |
| 8 | 8 | \ No newline at end of file |
@@ -64,7 +64,7 @@ |
||
| 64 | 64 | { |
| 65 | 65 | $modes = $this->formatModes($modes ?? $this->modes()); |
| 66 | 66 | |
| 67 | - if($modes) { |
|
| 67 | + if ($modes) { |
|
| 68 | 68 | $this->output->block('Passed modes: ' . $modes, null, 'comment'); |
| 69 | 69 | } |
| 70 | 70 | } |
@@ -43,11 +43,11 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | $syncer = new Syncer($locals = $this->syncingUsers(), $this->modes()); |
| 45 | 45 | |
| 46 | - if($locals->isEmpty()) { |
|
| 46 | + if ($locals->isEmpty()) { |
|
| 47 | 47 | $this->info('No local users found.'); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - if(!$this->confirm('There are ' . $locals->count() . ' local user(s) to export. Continue?', $this->option('no-interaction'))) { |
|
| 50 | + if (!$this->confirm('There are ' . $locals->count() . ' local user(s) to export. Continue?', $this->option('no-interaction'))) { |
|
| 51 | 51 | return; |
| 52 | 52 | } |
| 53 | 53 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | private function syncingUsers() |
| 104 | 104 | { |
| 105 | - if(!count($ids = ConsoleHelper::stringToArray($this->option('users')))) { |
|
| 105 | + if (!count($ids = ConsoleHelper::stringToArray($this->option('users')))) { |
|
| 106 | 106 | return Syncer::retrieveLocals(); |
| 107 | 107 | } |
| 108 | 108 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | private function filePath() |
| 121 | 121 | { |
| 122 | - if(!$path = $this->option('path')) { |
|
| 122 | + if (!$path = $this->option('path')) { |
|
| 123 | 123 | $path = storage_path('app'); |
| 124 | 124 | } |
| 125 | 125 | |