@@ -11,7 +11,7 @@ |
||
11 | 11 | { |
12 | 12 | public function handle(Registered $event) |
13 | 13 | { |
14 | - if (($event->user->providers === null || empty($event->user->providers)) && $event->user instanceof MustVerifyEmail && ! $event->user->hasVerifiedEmail()) { |
|
14 | + if (($event->user->providers === null || empty($event->user->providers)) && $event->user instanceof MustVerifyEmail && !$event->user->hasVerifiedEmail()) { |
|
15 | 15 | $event->user->sendEmailVerificationNotification(); |
16 | 16 | } |
17 | 17 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | public function handle($request, Closure $next) |
12 | 12 | { |
13 | 13 | $user = Auth::user(); |
14 | - if(!$user->hasVerifiedEmail()){ |
|
14 | + if (!$user->hasVerifiedEmail()) { |
|
15 | 15 | $request->session()->flash('from_forum', true); |
16 | 16 | return redirect()->route('verification.notice'); |
17 | 17 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | public function adminlte_image() |
38 | 38 | { |
39 | 39 | $urlPicture = $this->path_picture != "" ? asset('storage/'.str_replace('app/public/', '', $this->path_picture)) : null; |
40 | - if(!isset($urlPicture) || $urlPicture === ""){ |
|
40 | + if (!isset($urlPicture) || $urlPicture === "") { |
|
41 | 41 | $urlPicture = url('').'/'.config('adminlte.logo_img'); |
42 | 42 | } |
43 | 43 | return $urlPicture; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | public function adminlte_desc() |
47 | 47 | { |
48 | 48 | $desc = $this->firstname.' '.$this->lastname; |
49 | - if($this->organization_id !== null){ |
|
49 | + if ($this->organization_id !== null) { |
|
50 | 50 | $organization = app(OrganizationRepository::class)->get($this->organization_id); |
51 | 51 | $desc .= ' - organisme : '.$organization->name(); |
52 | 52 | } |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | public function sendEmailVerificationNotification() |
77 | 77 | { |
78 | 78 | $callback = ''; |
79 | - if(session()->has('wiki_callback')){ |
|
79 | + if (session()->has('wiki_callback')) { |
|
80 | 80 | $callback = base64_encode(urldecode(session()->get('wiki_callback'))); |
81 | 81 | } |
82 | 82 | |
83 | - if(session()->has('sso')){ |
|
83 | + if (session()->has('sso')) { |
|
84 | 84 | $sso = session()->get('sso'); |
85 | 85 | $sig = session()->get('sig'); |
86 | 86 | $callback = base64_encode(url('discourse/sso?sso='.$sso.'&sig='.$sig)); |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | |
106 | 106 | public function addCharacteristics(array $characteristics) |
107 | 107 | { |
108 | - foreach($characteristics as $characteristicUuid){ |
|
109 | - $characteristic = CharacteristicsModel::where('uuid', (string)$characteristicUuid)->first(); |
|
110 | - if(isset($characteristic)) { |
|
108 | + foreach ($characteristics as $characteristicUuid) { |
|
109 | + $characteristic = CharacteristicsModel::where('uuid', (string) $characteristicUuid)->first(); |
|
110 | + if (isset($characteristic)) { |
|
111 | 111 | $this->characteristics()->save($characteristic); |
112 | 112 | } |
113 | 113 | } |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | public function syncCharacteristics(array $characteristics) |
117 | 117 | { |
118 | 118 | $characteristicsToSync = []; |
119 | - foreach($characteristics as $characteristicUuid){ |
|
120 | - $characteristicModel = CharacteristicsModel::where('uuid', (string)$characteristicUuid)->first(); |
|
121 | - if(isset($characteristicModel)) { |
|
119 | + foreach ($characteristics as $characteristicUuid) { |
|
120 | + $characteristicModel = CharacteristicsModel::where('uuid', (string) $characteristicUuid)->first(); |
|
121 | + if (isset($characteristicModel)) { |
|
122 | 122 | $characteristicsToSync[] = $characteristicModel->id; |
123 | 123 | } |
124 | 124 | } |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | |
24 | 24 | public function deleted(PageModel $pageModel) |
25 | 25 | { |
26 | - Log::info('Deleting all data from the page internal id: ' . $pageModel->id); |
|
27 | - DB::transaction(function () use($pageModel){ |
|
26 | + Log::info('Deleting all data from the page internal id: '.$pageModel->id); |
|
27 | + DB::transaction(function() use($pageModel){ |
|
28 | 28 | try { |
29 | 29 | $characteristic = CharacteristicsModel::query()->where('page_id', $pageModel->page_id)->first(); |
30 | 30 | if (isset($characteristic)) { |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | UserCharacteristicsModel::query()->where('characteristic_id', $characteristic->id)->delete(); |
37 | 37 | } |
38 | 38 | } catch (\Throwable $e) { |
39 | - Log::emergency('Error deleting all data from the page internal id: ' . $pageModel->id); |
|
39 | + Log::emergency('Error deleting all data from the page internal id: '.$pageModel->id); |
|
40 | 40 | throw $e; |
41 | 41 | } |
42 | 42 | }); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | public function toDto() |
44 | 44 | { |
45 | 45 | $icon = null; |
46 | - if(isset($this->icon)){ |
|
46 | + if (isset($this->icon)) { |
|
47 | 47 | $icon = route('api.icon.serve', ['id' => $this->uuid]); |
48 | 48 | } |
49 | 49 | return new CharacteristicDto( |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | public function picturePath():string |
60 | 60 | { |
61 | - return storage_path('app/public/characteristics/' . $this->uuid . '.png'); |
|
61 | + return storage_path('app/public/characteristics/'.$this->uuid.'.png'); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | public function toDomain() |
@@ -12,31 +12,31 @@ |
||
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 | - }elseif($provider === 'facebook'){ |
|
17 | + }elseif ($provider === 'facebook') { |
|
18 | 18 | $user = Socialite::driver($provider)->fields(['name', 'first_name', 'last_name', 'email'])->user(); |
19 | - }else { |
|
19 | + } else { |
|
20 | 20 | $user = Socialite::driver($provider)->stateless()->user(); |
21 | 21 | } |
22 | 22 | |
23 | 23 | $email = $user->getEmail(); |
24 | 24 | |
25 | 25 | // For twitter, we prefer to use the name. If empty we'll use the twitter account (nickname): |
26 | - $firstname = $user->getName() !== null ? $user->getName() : $user->getNickname(); |
|
27 | - if(!empty($user->user['given_name'])){ |
|
26 | + $firstname = $user->getName() !== null ? $user->getName() : $user->getNickname(); |
|
27 | + if (!empty($user->user['given_name'])) { |
|
28 | 28 | |
29 | 29 | $firstname = $user->user['given_name']; |
30 | - }elseif (!empty($user->user['first_name'])){ |
|
30 | + }elseif (!empty($user->user['first_name'])) { |
|
31 | 31 | |
32 | 32 | $firstname = $user->user['first_name']; |
33 | 33 | } |
34 | 34 | |
35 | 35 | $lastname = $user->getName(); |
36 | - if(!empty($user->user['family_name'])){ |
|
36 | + if (!empty($user->user['family_name'])) { |
|
37 | 37 | |
38 | 38 | $lastname = $user->user['family_name']; |
39 | - }elseif (!empty($user->user['last_name'])){ |
|
39 | + }elseif (!empty($user->user['last_name'])) { |
|
40 | 40 | |
41 | 41 | $lastname = $user->user['last_name']; |
42 | 42 | } |
@@ -14,9 +14,9 @@ discard block |
||
14 | 14 | { |
15 | 15 | if($provider === 'twitter'){ |
16 | 16 | $user = Socialite::driver($provider)->user(); |
17 | - }elseif($provider === 'facebook'){ |
|
17 | + } elseif($provider === 'facebook'){ |
|
18 | 18 | $user = Socialite::driver($provider)->fields(['name', 'first_name', 'last_name', 'email'])->user(); |
19 | - }else { |
|
19 | + } else { |
|
20 | 20 | $user = Socialite::driver($provider)->stateless()->user(); |
21 | 21 | } |
22 | 22 | |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | if(!empty($user->user['given_name'])){ |
28 | 28 | |
29 | 29 | $firstname = $user->user['given_name']; |
30 | - }elseif (!empty($user->user['first_name'])){ |
|
30 | + } elseif (!empty($user->user['first_name'])){ |
|
31 | 31 | |
32 | 32 | $firstname = $user->user['first_name']; |
33 | 33 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | if(!empty($user->user['family_name'])){ |
37 | 37 | |
38 | 38 | $lastname = $user->user['family_name']; |
39 | - }elseif (!empty($user->user['last_name'])){ |
|
39 | + } elseif (!empty($user->user['last_name'])){ |
|
40 | 40 | |
41 | 41 | $lastname = $user->user['last_name']; |
42 | 42 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | $fillWikiUserProfile->fill(Auth::user()->uuid, $role, $firstname, $lastname, $email, $postalCode, $farmingType); |
47 | 47 | |
48 | - if(Auth::user()->hasVerifiedEmail()) { |
|
48 | + if (Auth::user()->hasVerifiedEmail()) { |
|
49 | 49 | $user = Auth::user(); |
50 | 50 | if ($request->session()->has('wiki_callback')) { |
51 | 51 | $user->wiki_token = $request->session()->get('wiki_token'); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | return redirect($callback); |
55 | 55 | } |
56 | 56 | |
57 | - if($request->session()->has('sso')){ |
|
57 | + if ($request->session()->has('sso')) { |
|
58 | 58 | $sso = $request->session()->get('sso'); |
59 | 59 | $sig = $request->session()->get('sig'); |
60 | 60 | return redirect('discourse/sso?sso='.$sso.'&sig='.$sig); |
@@ -24,11 +24,11 @@ discard block |
||
24 | 24 | |
25 | 25 | public function showLoginForm(Request $request) |
26 | 26 | { |
27 | - if($request->session()->has('should_attach_to_organization')) { |
|
27 | + if ($request->session()->has('should_attach_to_organization')) { |
|
28 | 28 | session()->reflash(); |
29 | 29 | } |
30 | 30 | |
31 | - if($request->has('wiki_callback')){ |
|
31 | + if ($request->has('wiki_callback')) { |
|
32 | 32 | session()->flash('wiki_callback', $request->input('wiki_callback')); |
33 | 33 | session()->flash('wiki_token', $request->input('wiki_token')); |
34 | 34 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | public function logout(Request $request) |
39 | 39 | { |
40 | - if($request->session()->has('should_attach_to_organization')) { |
|
40 | + if ($request->session()->has('should_attach_to_organization')) { |
|
41 | 41 | $shouldAttach = $request->session()->get('should_attach_to_organization'); |
42 | 42 | $shouldAttachToken = $request->session()->get('should_attach_to_organization_token'); |
43 | 43 | $linkToRedirect = $request->session()->get('should_attach_to_organization_redirect'); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | $request->session()->regenerateToken(); |
51 | 51 | |
52 | - if(isset($shouldAttach)){ |
|
52 | + if (isset($shouldAttach)) { |
|
53 | 53 | $request->session()->flash('should_attach_to_organization', $shouldAttach); |
54 | 54 | $request->session()->flash('should_attach_to_organization_token', $shouldAttachToken); |
55 | 55 | $request->session()->flash('should_attach_to_organization_redirect', $linkToRedirect); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | protected function loggedOut(Request $request) |
68 | 68 | { |
69 | 69 | $request->session()->reflash(); |
70 | - if($request->session()->has('should_attach_to_organization')){ |
|
70 | + if ($request->session()->has('should_attach_to_organization')) { |
|
71 | 71 | $linkToRedirect = $request->session()->get('should_attach_to_organization_redirect'); |
72 | 72 | return $request->wantsJson() |
73 | 73 | ? new Response('', 204) |
@@ -77,12 +77,12 @@ discard block |
||
77 | 77 | |
78 | 78 | protected function authenticated(Request $request, $user) |
79 | 79 | { |
80 | - if($user->context_id === null){ |
|
80 | + if ($user->context_id === null) { |
|
81 | 81 | return redirect()->route('wizard.profile'); |
82 | 82 | } |
83 | 83 | |
84 | - if($request->session()->has('sso')){ |
|
85 | - if(!$user->hasVerifiedEmail()){ |
|
84 | + if ($request->session()->has('sso')) { |
|
85 | + if (!$user->hasVerifiedEmail()) { |
|
86 | 86 | return redirect()->route('verification.notice'); |
87 | 87 | } |
88 | 88 | $sso = $request->session()->get('sso'); |
@@ -90,17 +90,17 @@ discard block |
||
90 | 90 | return redirect('discourse/sso?sso='.$sso.'&sig='.$sig); |
91 | 91 | } |
92 | 92 | |
93 | - if($request->session()->has('wiki_callback')){ |
|
93 | + if ($request->session()->has('wiki_callback')) { |
|
94 | 94 | $user->wiki_token = $request->session()->get('wiki_token'); |
95 | 95 | $user->save(); |
96 | 96 | $callback = urldecode($request->session()->get('wiki_callback')); |
97 | - if(!$user->hasVerifiedEmail()){ |
|
97 | + if (!$user->hasVerifiedEmail()) { |
|
98 | 98 | return redirect()->route('verification.notice'); |
99 | 99 | } |
100 | 100 | return redirect($callback); |
101 | 101 | } |
102 | 102 | |
103 | - if($request->session()->has('should_attach_to_organization') && $request->session()->get('should_attach_to_organization') !== null){ |
|
103 | + if ($request->session()->has('should_attach_to_organization') && $request->session()->get('should_attach_to_organization') !== null) { |
|
104 | 104 | $token = $request->session()->get('should_attach_to_organization_token'); |
105 | 105 | $link = route('organization.invite.show').'?&token='.$token; |
106 | 106 | return $request->wantsJson() |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | public function redirectToProvider(string $provider) |
114 | 114 | { |
115 | - if($provider === 'twitter'){ |
|
115 | + if ($provider === 'twitter') { |
|
116 | 116 | config(['services.'.$provider.'.redirect' => env(strtoupper($provider).'_CALLBACK_LOGIN')]); |
117 | 117 | return Socialite::driver($provider)->redirect(); |
118 | 118 | } |