@@ -187,7 +187,7 @@ |
||
| 187 | 187 | { |
| 188 | 188 | $user = \App\User::where('uuid', $userId)->first(); |
| 189 | 189 | if(!isset($user)){ |
| 190 | - return; |
|
| 190 | + return; |
|
| 191 | 191 | } |
| 192 | 192 | $user->markEmailAsVerified(); |
| 193 | 193 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | public function getByEmail(string $email): ?User |
| 18 | 18 | { |
| 19 | 19 | $record = \App\User::where('email', $email)->first(); |
| 20 | - if(!isset($record)){ |
|
| 20 | + if (!isset($record)) { |
|
| 21 | 21 | return null; |
| 22 | 22 | } |
| 23 | 23 | $roles = $record->roles()->pluck('name')->toArray(); |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | public function getById(string $id): ?User |
| 28 | 28 | { |
| 29 | 29 | $record = \App\User::where('uuid', $id)->first(); |
| 30 | - if(!isset($record)){ |
|
| 30 | + if (!isset($record)) { |
|
| 31 | 31 | return null; |
| 32 | 32 | } |
| 33 | 33 | $roles = $record->roles()->pluck('name')->toArray(); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | unset($data['roles']); |
| 60 | 60 | $userModel->fill($data); |
| 61 | 61 | |
| 62 | - if($oldEmail !== $data['email']){ |
|
| 62 | + if ($oldEmail !== $data['email']) { |
|
| 63 | 63 | $userModel->email_verified_at = null; |
| 64 | 64 | $userModel->sendEmailVerificationNotification(); |
| 65 | 65 | } |
@@ -100,13 +100,13 @@ discard block |
||
| 100 | 100 | ->offset(($page-1)*$perPage) |
| 101 | 101 | ->limit($perPage) |
| 102 | 102 | ->get(); |
| 103 | - if(empty($records)){ |
|
| 103 | + if (empty($records)) { |
|
| 104 | 104 | return []; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | $users = []; |
| 108 | - foreach($records as $record){ |
|
| 109 | - if($record->uuid === null){ |
|
| 108 | + foreach ($records as $record) { |
|
| 109 | + if ($record->uuid === null) { |
|
| 110 | 110 | $identity = new Identity(Uuid::uuid4(), $record->iemail, $record->ifirstname, $record->ilastname, null); |
| 111 | 111 | $state = new State($organizationId, null, false, []); |
| 112 | 112 | $users[] = new UserDto($identity, $state); |
@@ -132,11 +132,11 @@ discard block |
||
| 132 | 132 | public function getAdminOfOrganization(string $organizationId): array |
| 133 | 133 | { |
| 134 | 134 | $records = \App\User::role(['admin'])->where('organization_id', $organizationId)->get(); |
| 135 | - if(empty($records)){ |
|
| 135 | + if (empty($records)) { |
|
| 136 | 136 | return []; |
| 137 | 137 | } |
| 138 | 138 | $users = []; |
| 139 | - foreach($records as $record){ |
|
| 139 | + foreach ($records as $record) { |
|
| 140 | 140 | $roles = \App\User::find($record->id)->roles()->pluck('name')->toArray(); |
| 141 | 141 | $users[] = new User($record->uuid, $record->email, $record->firstname, $record->lastname, $record->organization_id, $record->path_picture, $roles); |
| 142 | 142 | } |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | public function getByProvider(string $provider, string $providerId): ?User |
| 147 | 147 | { |
| 148 | 148 | $record = \App\User::where('providers->'.$provider, $providerId)->first(); |
| 149 | - if(!isset($record)){ |
|
| 149 | + if (!isset($record)) { |
|
| 150 | 150 | return null; |
| 151 | 151 | } |
| 152 | 152 | $roles = $record->roles()->pluck('name')->toArray(); |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | public function getStats(string $userId): Stats |
| 157 | 157 | { |
| 158 | 158 | $record = \App\User::where('uuid', $userId)->first(); |
| 159 | - if(isset($record) && $record->wiki_stats !== null){ |
|
| 159 | + if (isset($record) && $record->wiki_stats !== null) { |
|
| 160 | 160 | return new Stats($record->wiki_stats); |
| 161 | 161 | } |
| 162 | 162 | return new Stats([]); |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | public function verifyEmail(string $userId) |
| 192 | 192 | { |
| 193 | 193 | $user = \App\User::where('uuid', $userId)->first(); |
| 194 | - if(!isset($user)){ |
|
| 194 | + if (!isset($user)) { |
|
| 195 | 195 | return; |
| 196 | 196 | } |
| 197 | 197 | $user->markEmailAsVerified(); |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | public function handle($request, \Closure $next) |
| 12 | 12 | { |
| 13 | 13 | $user = Auth::user(); |
| 14 | - if($user->context_id === null){ |
|
| 14 | + if ($user->context_id === null) { |
|
| 15 | 15 | return $next($request); |
| 16 | 16 | } |
| 17 | 17 | return redirect('/profile'); |
@@ -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') |
@@ -14,12 +14,12 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | protected function redirectTo($request) |
| 16 | 16 | { |
| 17 | - if($request->has('sso')){ |
|
| 17 | + if ($request->has('sso')) { |
|
| 18 | 18 | session()->put('sso', $request->get('sso')); |
| 19 | 19 | session()->put('sig', $request->get('sig')); |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - if (! $request->expectsJson()) { |
|
| 22 | + if (!$request->expectsJson()) { |
|
| 23 | 23 | return route('login'); |
| 24 | 24 | } |
| 25 | 25 | } |
@@ -15,11 +15,11 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | public function handle($request, Closure $next) |
| 17 | 17 | { |
| 18 | - if(session()->has('wiki_callback')){ |
|
| 18 | + if (session()->has('wiki_callback')) { |
|
| 19 | 19 | session()->keep(['wiki_callback', 'wiki_token']); |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - if($request->has('sso')){ |
|
| 22 | + if ($request->has('sso')) { |
|
| 23 | 23 | session()->put('sso', $request->get('sso')); |
| 24 | 24 | session()->put('sig', $request->get('sig')); |
| 25 | 25 | } |
@@ -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 | } |
@@ -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 | $request->session()->flash('from_forum', true); |
| 87 | 87 | return redirect()->route('email.verify'); |
| 88 | 88 | } |
@@ -91,14 +91,14 @@ discard block |
||
| 91 | 91 | return redirect('discourse/sso?sso='.$sso.'&sig='.$sig); |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - if($request->session()->has('wiki_callback')){ |
|
| 94 | + if ($request->session()->has('wiki_callback')) { |
|
| 95 | 95 | $user->wiki_token = $request->session()->get('wiki_token'); |
| 96 | 96 | $user->save(); |
| 97 | 97 | $callback = urldecode($request->session()->get('wiki_callback')); |
| 98 | 98 | return redirect($callback); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - if($request->session()->has('should_attach_to_organization') && $request->session()->get('should_attach_to_organization') !== null){ |
|
| 101 | + if ($request->session()->has('should_attach_to_organization') && $request->session()->get('should_attach_to_organization') !== null) { |
|
| 102 | 102 | $token = $request->session()->get('should_attach_to_organization_token'); |
| 103 | 103 | $link = route('organization.invite.show').'?&token='.$token; |
| 104 | 104 | return $request->wantsJson() |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | public function redirectToProvider(string $provider) |
| 112 | 112 | { |
| 113 | - if($provider === 'twitter'){ |
|
| 113 | + if ($provider === 'twitter') { |
|
| 114 | 114 | config(['services.'.$provider.'.redirect' => env(strtoupper($provider).'_CALLBACK_LOGIN')]); |
| 115 | 115 | return Socialite::driver($provider)->redirect(); |
| 116 | 116 | } |
@@ -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 | } |
@@ -15,14 +15,14 @@ |
||
| 15 | 15 | try { |
| 16 | 16 | $user = $verified->user; |
| 17 | 17 | $sync = UserSyncDiscourseModel::where('user_id', $user->id)->first(); |
| 18 | - if(!isset($sync)) { |
|
| 18 | + if (!isset($sync)) { |
|
| 19 | 19 | $sync = new UserSyncDiscourseModel(); |
| 20 | 20 | } |
| 21 | 21 | $sync->user_id = $user->id; |
| 22 | 22 | $sync->uuid = $user->uuid; |
| 23 | 23 | $sync->sync = false; |
| 24 | 24 | $sync->save(); |
| 25 | - }catch (\Throwable $e){ |
|
| 25 | + } catch (\Throwable $e) { |
|
| 26 | 26 | Log::emergency('Error when sync asking for user : '.$user->id); |
| 27 | 27 | report($e); |
| 28 | 28 | } |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | $sync->uuid = $user->uuid; |
| 23 | 23 | $sync->sync = false; |
| 24 | 24 | $sync->save(); |
| 25 | - }catch (\Throwable $e){ |
|
| 25 | + } catch (\Throwable $e){ |
|
| 26 | 26 | Log::emergency('Error when sync asking for user : '.$user->id); |
| 27 | 27 | report($e); |
| 28 | 28 | } |