@@ -106,7 +106,7 @@ |
||
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | return redirect()->route('wizard.profile'); |
| 109 | - }catch (ValidationException $e) { |
|
| 109 | + } catch (ValidationException $e) { |
|
| 110 | 110 | $attributes = $e->validator->attributes(); |
| 111 | 111 | $attributes['provider'] = $provider; |
| 112 | 112 | return redirect()->route('register-social-network') |
@@ -31,19 +31,19 @@ discard block |
||
| 31 | 31 | { |
| 32 | 32 | $email = $firstname = $lastname = ''; |
| 33 | 33 | |
| 34 | - if($request->session()->has('user_to_register')){ |
|
| 34 | + if ($request->session()->has('user_to_register')) { |
|
| 35 | 35 | $user = $request->session()->get('user_to_register'); |
| 36 | 36 | $email = $user['email']; |
| 37 | 37 | $firstname = $user['firstname']; |
| 38 | 38 | $lastname = $user['lastname']; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - if($request->has('wiki_callback')){ |
|
| 41 | + if ($request->has('wiki_callback')) { |
|
| 42 | 42 | session()->flash('wiki_callback', $request->input('wiki_callback')); |
| 43 | 43 | session()->flash('wiki_token', $request->input('wiki_token')); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - if(session()->has('should_attach_to_organization')) { |
|
| 46 | + if (session()->has('should_attach_to_organization')) { |
|
| 47 | 47 | session()->reflash(); |
| 48 | 48 | } |
| 49 | 49 | return view('public.auth.register', [ |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | protected function validator(array $data) |
| 57 | 57 | { |
| 58 | - if(session()->has('should_attach_to_organization')) { |
|
| 58 | + if (session()->has('should_attach_to_organization')) { |
|
| 59 | 59 | session()->reflash(); |
| 60 | 60 | } |
| 61 | 61 | return Validator::make($data, [ |
@@ -81,12 +81,12 @@ discard block |
||
| 81 | 81 | protected function registered(Request $request, $user) |
| 82 | 82 | { |
| 83 | 83 | $this->guard()->login($user, true); |
| 84 | - if($request->session()->has('should_attach_to_organization')){ |
|
| 84 | + if ($request->session()->has('should_attach_to_organization')) { |
|
| 85 | 85 | app(AttachUserToAnOrganization::class)->attach($user->uuid, $request->session()->get('should_attach_to_organization')); |
| 86 | 86 | } |
| 87 | 87 | $user = Auth::user(); |
| 88 | 88 | |
| 89 | - if($user->context_id === null) { |
|
| 89 | + if ($user->context_id === null) { |
|
| 90 | 90 | return redirect()->route('wizard.profile'); |
| 91 | 91 | } |
| 92 | 92 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | /** |
| 95 | 95 | * should be deleted dead code ? |
| 96 | 96 | */ |
| 97 | - if($request->session()->has('wiki_callback')){ |
|
| 97 | + if ($request->session()->has('wiki_callback')) { |
|
| 98 | 98 | $user->wiki_token = $request->session()->get('wiki_token'); |
| 99 | 99 | $user->save(); |
| 100 | 100 | $callback = urldecode($request->session()->get('wiki_callback')); |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | public function redirectToProvider(string $provider) |
| 108 | 108 | { |
| 109 | 109 | config(['services.'.$provider.'.redirect' => env(strtoupper($provider).'_CALLBACK')]); |
| 110 | - if($provider === 'twitter'){ |
|
| 110 | + if ($provider === 'twitter') { |
|
| 111 | 111 | return Socialite::driver($provider)->redirect(); |
| 112 | 112 | } |
| 113 | 113 | return Socialite::driver($provider)->redirectUrl(config('services.'.$provider.'.redirect'))->redirect(); |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | $user = User::where('uuid', $userId)->first(); |
| 121 | 121 | $this->guard()->login($user); |
| 122 | 122 | |
| 123 | - if($user->context_id !== null){ |
|
| 123 | + if ($user->context_id !== null) { |
|
| 124 | 124 | $user->wiki_token = $request->session()->get('wiki_token'); |
| 125 | 125 | $user->save(); |
| 126 | 126 | $callback = urldecode($request->session()->get('wiki_callback')); |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | return redirect()->route('wizard.profile'); |
| 131 | - }catch (ValidationException $e) { |
|
| 131 | + } catch (ValidationException $e) { |
|
| 132 | 132 | $attributes = $e->validator->attributes(); |
| 133 | 133 | $attributes['provider'] = $provider; |
| 134 | 134 | return redirect()->route('register-social-network') |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | public function register(string $provider, SocialiteUser $socialiteUser) |
| 30 | 30 | { |
| 31 | 31 | $user = $this->userRepository->getByProvider($provider, $socialiteUser->providerId()); |
| 32 | - if(isset($user)){ |
|
| 32 | + if (isset($user)) { |
|
| 33 | 33 | return [ |
| 34 | 34 | 'user_id' => $user->id(), |
| 35 | 35 | 'provider_id' => $socialiteUser->providerId(), |
@@ -37,10 +37,10 @@ discard block |
||
| 37 | 37 | ]; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - if($socialiteUser->email() !== null && $socialiteUser->email() != "") { |
|
| 40 | + if ($socialiteUser->email() !== null && $socialiteUser->email() != "") { |
|
| 41 | 41 | $user = $this->userRepository->getByEmail($socialiteUser->email()); |
| 42 | 42 | } |
| 43 | - if(isset($user)){ |
|
| 43 | + if (isset($user)) { |
|
| 44 | 44 | $user->addProvider($provider, $socialiteUser->providerId()); |
| 45 | 45 | return [ |
| 46 | 46 | 'user_id' => $user->id(), |
@@ -15,12 +15,12 @@ discard block |
||
| 15 | 15 | { |
| 16 | 16 | $token = $request->input('wiki_token', null); |
| 17 | 17 | |
| 18 | - if($token === null || $token === ''){ |
|
| 18 | + if ($token === null || $token === '') { |
|
| 19 | 19 | return ['error' => 'invalid_token']; |
| 20 | 20 | } |
| 21 | 21 | $user = User::where('wiki_token', $token)->first(); |
| 22 | 22 | |
| 23 | - if($user === null){ |
|
| 23 | + if ($user === null) { |
|
| 24 | 24 | return ['error' => 'invalid_token']; |
| 25 | 25 | } |
| 26 | 26 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | public function logout() |
| 37 | 37 | { |
| 38 | 38 | $user = Auth::user(); |
| 39 | - if(isset($user)){ |
|
| 39 | + if (isset($user)) { |
|
| 40 | 40 | $user->wiki_token = ''; |
| 41 | 41 | $user->save(); |
| 42 | 42 | Auth::logout(); |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | { |
| 28 | 28 | $errors = []; |
| 29 | 29 | $user = $this->userRepository->getByEmail($email); |
| 30 | - if(isset($user) && $user->id() !== $userId){ |
|
| 30 | + if (isset($user) && $user->id() !== $userId) { |
|
| 31 | 31 | $errors[] = ['validation.unique']; |
| 32 | 32 | } |
| 33 | 33 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | 'email' => $email |
| 61 | 61 | ], $rules); |
| 62 | 62 | |
| 63 | - $validator->after(function () use ($validator, $errors) { |
|
| 63 | + $validator->after(function() use ($validator, $errors) { |
|
| 64 | 64 | foreach ($errors as $field => $error) { |
| 65 | 65 | $validator->errors()->add($field, $error); |
| 66 | 66 | } |
@@ -27,12 +27,12 @@ |
||
| 27 | 27 | $w = $img->width(); |
| 28 | 28 | |
| 29 | 29 | $img = Image::cache(function($image) use($pathPicture, $dim, $w, $h){ |
| 30 | - if($w <= $h) { |
|
| 31 | - $image->make($pathPicture)->widen($dim, function ($constraint) { |
|
| 30 | + if ($w <= $h) { |
|
| 31 | + $image->make($pathPicture)->widen($dim, function($constraint) { |
|
| 32 | 32 | $constraint->upsize(); |
| 33 | 33 | }); |
| 34 | - }else{ |
|
| 35 | - $image->make($pathPicture)->heighten($dim, function ($constraint) { |
|
| 34 | + } else { |
|
| 35 | + $image->make($pathPicture)->heighten($dim, function($constraint) { |
|
| 36 | 36 | $constraint->upsize(); |
| 37 | 37 | }); |
| 38 | 38 | } |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | $image->make($pathPicture)->widen($dim, function ($constraint) { |
| 32 | 32 | $constraint->upsize(); |
| 33 | 33 | }); |
| 34 | - }else{ |
|
| 34 | + } else{ |
|
| 35 | 35 | $image->make($pathPicture)->heighten($dim, function ($constraint) { |
| 36 | 36 | $constraint->upsize(); |
| 37 | 37 | }); |
@@ -12,15 +12,15 @@ |
||
| 12 | 12 | { |
| 13 | 13 | public function user(string $provider): SocialiteUser |
| 14 | 14 | { |
| 15 | - if($provider === 'twitter'){ |
|
| 15 | + if ($provider === 'twitter') { |
|
| 16 | 16 | $user = Socialite::driver($provider)->user(); |
| 17 | - }else { |
|
| 17 | + } else { |
|
| 18 | 18 | $user = Socialite::driver($provider)->stateless()->user(); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | $email = $user->getEmail(); |
| 22 | 22 | $firstname = $user->getNickname() !== null ? $user->getNickname() : $user->getName(); |
| 23 | - if(isset($user->user['given_name'])){ |
|
| 23 | + if (isset($user->user['given_name'])) { |
|
| 24 | 24 | $firstname = $user->user['given_name']; |
| 25 | 25 | } |
| 26 | 26 | $lastname = isset($user->user['family_name']) ? $user->user['family_name'] : $user->getName(); |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | { |
| 15 | 15 | if($provider === 'twitter'){ |
| 16 | 16 | $user = Socialite::driver($provider)->user(); |
| 17 | - }else { |
|
| 17 | + } else { |
|
| 18 | 18 | $user = Socialite::driver($provider)->stateless()->user(); |
| 19 | 19 | } |
| 20 | 20 | |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | public function toDto() |
| 34 | 34 | { |
| 35 | 35 | $icon = null; |
| 36 | - if(isset($this->icon)){ |
|
| 36 | + if (isset($this->icon)) { |
|
| 37 | 37 | $icon = route('api.icon.serve', ['id' => $this->uuid]); |
| 38 | 38 | } |
| 39 | 39 | return new CharacteristicDto( |
@@ -22,17 +22,17 @@ |
||
| 22 | 22 | { |
| 23 | 23 | $relativePath = $newPath; |
| 24 | 24 | $finalNewPath = storage_path().'/'.$newPath; |
| 25 | - if(isset($this->ext)){ |
|
| 25 | + if (isset($this->ext)) { |
|
| 26 | 26 | $finalNewPath = storage_path().'/'.$newPath.'.'.$this->ext; |
| 27 | 27 | $relativePath = $newPath.'.'.$this->ext; |
| 28 | 28 | } |
| 29 | - if(app(PictureHandler::class)->width($this->path) > 600) { |
|
| 29 | + if (app(PictureHandler::class)->width($this->path) > 600) { |
|
| 30 | 30 | app(PictureHandler::class)->widen($this->path, $finalNewPath, 600); |
| 31 | 31 | $this->relativePath = $relativePath; |
| 32 | 32 | return; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - if(app(PictureHandler::class)->height($this->path) > 400) { |
|
| 35 | + if (app(PictureHandler::class)->height($this->path) > 400) { |
|
| 36 | 36 | app(PictureHandler::class)->heighten($this->path, $finalNewPath, 400); |
| 37 | 37 | $this->relativePath = $relativePath; |
| 38 | 38 | return; |
@@ -39,23 +39,23 @@ |
||
| 39 | 39 | $organizationToJoin = $this->organizationRepository->get($organizationId); |
| 40 | 40 | |
| 41 | 41 | $currentUser = $this->authGateway->current(); |
| 42 | - if(isset($currentUser) && $currentUser->email() !== $email){ |
|
| 42 | + if (isset($currentUser) && $currentUser->email() !== $email) { |
|
| 43 | 43 | $action = 'logout'; |
| 44 | 44 | $action .= !isset($user) ? '-register' : '-login'; |
| 45 | 45 | |
| 46 | - if($action == 'logout-login') { |
|
| 46 | + if ($action == 'logout-login') { |
|
| 47 | 47 | return $this->badUserLoginToAcceptAction($action, $organizationToJoin); |
| 48 | 48 | } |
| 49 | 49 | return $this->returnLogoutAction($action, $organizationToJoin, $email, $firstname, $lastname); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | |
| 53 | - if(!isset($user)){ |
|
| 53 | + if (!isset($user)) { |
|
| 54 | 54 | return $this->returnRegisterAction($organizationId, $email, $firstname, $lastname); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | $currentUser = $this->authGateway->current(); |
| 58 | - if(!isset($currentUser)){ |
|
| 58 | + if (!isset($currentUser)) { |
|
| 59 | 59 | return $this->returnLoginAction($organizationToJoin); |
| 60 | 60 | } |
| 61 | 61 | |