@@ -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)) { |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public function login(string $email, string $password, bool $remember = false) |
| 86 | 86 | { |
| 87 | - if($this->disabled()) { |
|
| 87 | + if ($this->disabled()) { |
|
| 88 | 88 | return $this->handleFallback('login', compact('email', 'password', 'remember')); |
| 89 | 89 | } |
| 90 | 90 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public function unsafeLogin(string $email, bool $remember = false) |
| 108 | 108 | { |
| 109 | - if($this->disabled()) { |
|
| 109 | + if ($this->disabled()) { |
|
| 110 | 110 | return $this->handleFallback('unsafeLogin', compact('email', 'remember')); |
| 111 | 111 | } |
| 112 | 112 | |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | public function logout() |
| 124 | 124 | { |
| 125 | - if($this->disabled()) { |
|
| 125 | + if ($this->disabled()) { |
|
| 126 | 126 | return $this->handleFallback('logout'); |
| 127 | 127 | } |
| 128 | 128 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | public function register(int $userId, string $name, string $email, string $password, string $country) |
| 146 | 146 | { |
| 147 | - if($this->disabled()) { |
|
| 147 | + if ($this->disabled()) { |
|
| 148 | 148 | return []; |
| 149 | 149 | } |
| 150 | 150 | |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | */ |
| 163 | 163 | public function forgot(string $email) |
| 164 | 164 | { |
| 165 | - if($this->disabled()) { |
|
| 165 | + if ($this->disabled()) { |
|
| 166 | 166 | return $this->handleFallback('forgot', compact('email')); |
| 167 | 167 | } |
| 168 | 168 | |
@@ -183,13 +183,13 @@ discard block |
||
| 183 | 183 | */ |
| 184 | 184 | public function validatePasswordResetToken(string $token, string $email) |
| 185 | 185 | { |
| 186 | - if($this->disabled()) { |
|
| 186 | + if ($this->disabled()) { |
|
| 187 | 187 | return $this->handleFallback('validateReset', compact('token', 'email')); |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | $response = $this->client->request('validateReset', compact('token', 'email')); |
| 191 | 191 | |
| 192 | - if(!$this->client->success(true)) { |
|
| 192 | + if (!$this->client->success(true)) { |
|
| 193 | 193 | return false; |
| 194 | 194 | } |
| 195 | 195 | |
@@ -212,13 +212,13 @@ discard block |
||
| 212 | 212 | { |
| 213 | 213 | $parameters = compact('token', 'email', 'password', 'confirmation'); |
| 214 | 214 | |
| 215 | - if($this->disabled()) { |
|
| 215 | + if ($this->disabled()) { |
|
| 216 | 216 | return $this->handleFallback('resetPassword', $parameters); |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | $response = $this->client->request('reset', $parameters); |
| 220 | 220 | |
| 221 | - if(!$this->client->success(true)) { |
|
| 221 | + if (!$this->client->success(true)) { |
|
| 222 | 222 | return false; |
| 223 | 223 | } |
| 224 | 224 | |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | */ |
| 239 | 239 | public function update(int $id, ?string $name, ?string $email, ?string $password, ?string $country) |
| 240 | 240 | { |
| 241 | - if($this->disabled()) { |
|
| 241 | + if ($this->disabled()) { |
|
| 242 | 242 | return false; |
| 243 | 243 | } |
| 244 | 244 | |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | |
| 247 | 247 | $response = $this->client->request('update', compact('id', 'attributes')); |
| 248 | 248 | |
| 249 | - if(!$this->client->success(true)) { |
|
| 249 | + if (!$this->client->success(true)) { |
|
| 250 | 250 | return false; |
| 251 | 251 | } |
| 252 | 252 | |
@@ -262,13 +262,13 @@ discard block |
||
| 262 | 262 | */ |
| 263 | 263 | public function delete(int $id) |
| 264 | 264 | { |
| 265 | - if($this->disabled()) { |
|
| 265 | + if ($this->disabled()) { |
|
| 266 | 266 | return false; |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | $response = $this->client->request('delete', compact('id')); |
| 270 | 270 | |
| 271 | - if(!$this->client->success(true)) { |
|
| 271 | + if (!$this->client->success(true)) { |
|
| 272 | 272 | return false; |
| 273 | 273 | } |
| 274 | 274 | |
@@ -284,13 +284,13 @@ discard block |
||
| 284 | 284 | */ |
| 285 | 285 | public function restore(int $id) |
| 286 | 286 | { |
| 287 | - if($this->disabled()) { |
|
| 287 | + if ($this->disabled()) { |
|
| 288 | 288 | return false; |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | $response = $this->client->request('restore', compact('id')); |
| 292 | 292 | |
| 293 | - if(!$this->client->success(true)) { |
|
| 293 | + if (!$this->client->success(true)) { |
|
| 294 | 294 | return false; |
| 295 | 295 | } |
| 296 | 296 | |
@@ -304,18 +304,18 @@ discard block |
||
| 304 | 304 | */ |
| 305 | 305 | public function retrieveByToken() |
| 306 | 306 | { |
| 307 | - if($this->disabled()) { |
|
| 307 | + if ($this->disabled()) { |
|
| 308 | 308 | return null; |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | try { |
| 312 | 312 | $response = $this->client->request('me'); |
| 313 | 313 | } |
| 314 | - catch(\Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException $e) { |
|
| 314 | + catch (\Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException $e) { |
|
| 315 | 315 | return null; |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | - if(!$this->client->success(true)) { |
|
| 318 | + if (!$this->client->success(true)) { |
|
| 319 | 319 | return null; |
| 320 | 320 | } |
| 321 | 321 | |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | { |
| 350 | 350 | $handler = Str::camel(str_replace('.', ' ', $key)); |
| 351 | 351 | |
| 352 | - if(!method_exists($this->handlersContainer, $handler)) { |
|
| 352 | + if (!method_exists($this->handlersContainer, $handler)) { |
|
| 353 | 353 | throw new \InvalidArgumentException("Handler `{$handler}` cannot be found"); |
| 354 | 354 | } |
| 355 | 355 | |
@@ -389,11 +389,11 @@ discard block |
||
| 389 | 389 | { |
| 390 | 390 | $cache = new Cache(); |
| 391 | 391 | |
| 392 | - if(!func_num_args()) { |
|
| 392 | + if (!func_num_args()) { |
|
| 393 | 393 | return $cache; |
| 394 | 394 | } |
| 395 | 395 | |
| 396 | - if(func_num_args() === 1) { |
|
| 396 | + if (func_num_args() === 1) { |
|
| 397 | 397 | return $cache->get($key); |
| 398 | 398 | } |
| 399 | 399 | |
@@ -413,11 +413,11 @@ discard block |
||
| 413 | 413 | { |
| 414 | 414 | $cache = new Cache(); |
| 415 | 415 | |
| 416 | - if(func_num_args() === 1) { |
|
| 416 | + if (func_num_args() === 1) { |
|
| 417 | 417 | return $cache->getUserParams($remoteId); |
| 418 | 418 | } |
| 419 | 419 | |
| 420 | - if(func_num_args() === 2) { |
|
| 420 | + if (func_num_args() === 2) { |
|
| 421 | 421 | return $cache->getUserParam($remoteId, $key); |
| 422 | 422 | } |
| 423 | 423 | |
@@ -441,10 +441,10 @@ discard block |
||
| 441 | 441 | try { |
| 442 | 442 | $output = $callback(); |
| 443 | 443 | } |
| 444 | - catch(\Exception $e) { |
|
| 444 | + catch (\Exception $e) { |
|
| 445 | 445 | DB::rollBack(); |
| 446 | 446 | |
| 447 | - if(is_null($fallback)) { |
|
| 447 | + if (is_null($fallback)) { |
|
| 448 | 448 | throw $e; |
| 449 | 449 | } |
| 450 | 450 | |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | */ |
| 528 | 528 | protected function encrypter(): Encrypter |
| 529 | 529 | { |
| 530 | - if (!$key = config('connector.credentials.auth.cryptKey')){ |
|
| 530 | + if (!$key = config('connector.credentials.auth.cryptKey')) { |
|
| 531 | 531 | throw new \RuntimeException('The crypt key should be provided.'); |
| 532 | 532 | } |
| 533 | 533 | |
@@ -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 | |