@@ -16,7 +16,7 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | public function handle($request, Closure $next) |
| 18 | 18 | { |
| 19 | - if(Auth::user() !== null && !Auth::user()->hasRole('admin')){ |
|
| 19 | + if (Auth::user() !== null && !Auth::user()->hasRole('admin')) { |
|
| 20 | 20 | //return redirect(env('WIKI_URL')); |
| 21 | 21 | } |
| 22 | 22 | return $next($request); |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | // need to show to the user. Finally, we'll send out a proper response. |
| 39 | 39 | $response = $this->broker()->sendResetLink( |
| 40 | 40 | $this->credentials($request), |
| 41 | - function ($user, $token){ |
|
| 41 | + function($user, $token) { |
|
| 42 | 42 | Mail::to($user->email) |
| 43 | 43 | ->send(new PasswordResetLink($user, $token)); |
| 44 | 44 | } |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | $farmingType = $request->input('farming_type') !== null ? $request->input('farming_type') : []; |
| 40 | 40 | |
| 41 | 41 | $fillWikiUserProfile->fill(Auth::user()->uuid, $role, $firstname, $lastname, $email, $postalCode, $farmingType); |
| 42 | - if(session()->has('wiki_callback')){ |
|
| 42 | + if (session()->has('wiki_callback')) { |
|
| 43 | 43 | $user = Auth::user(); |
| 44 | 44 | $user->wiki_token = session()->get('wiki_token'); |
| 45 | 45 | $user->save(); |
@@ -11,11 +11,11 @@ |
||
| 11 | 11 | |
| 12 | 12 | class ContextRepositorySql implements ContextRepository |
| 13 | 13 | { |
| 14 | - public function getByUser(string $userId):?Context |
|
| 14 | + public function getByUser(string $userId): ?Context |
|
| 15 | 15 | { |
| 16 | 16 | $user = User::where('uuid', $userId)->first(); |
| 17 | 17 | $context = DB::table('contexts')->where('id', $user->context_id)->first(); |
| 18 | - if($context == null){ |
|
| 18 | + if ($context == null) { |
|
| 19 | 19 | return null; |
| 20 | 20 | } |
| 21 | 21 | return new Context($context->uuid, $context->postal_code, json_decode($context->farmings, true)); |
@@ -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(), |
@@ -11,10 +11,10 @@ |
||
| 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 | - if(session()->has('wiki_callback')){ |
|
| 17 | + if (session()->has('wiki_callback')) { |
|
| 18 | 18 | $user->wiki_token = session()->get('wiki_token'); |
| 19 | 19 | $user->save(); |
| 20 | 20 | $callback = urldecode(session()->get('wiki_callback')); |
@@ -31,7 +31,7 @@ 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']; |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | protected function validator(array $data) |
| 49 | 49 | { |
| 50 | - if(session()->has('should_attach_to_organization')) { |
|
| 50 | + if (session()->has('should_attach_to_organization')) { |
|
| 51 | 51 | session()->reflash(); |
| 52 | 52 | } |
| 53 | 53 | return Validator::make($data, [ |
@@ -69,16 +69,16 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | protected function registered(Request $request, $user) |
| 71 | 71 | { |
| 72 | - if($request->session()->has('should_attach_to_organization')){ |
|
| 72 | + if ($request->session()->has('should_attach_to_organization')) { |
|
| 73 | 73 | app(AttachUserToAnOrganization::class)->attach($user->uuid, $request->session()->get('should_attach_to_organization')); |
| 74 | 74 | } |
| 75 | 75 | $user = Auth::user(); |
| 76 | 76 | |
| 77 | - if($user->context_id === null) { |
|
| 77 | + if ($user->context_id === null) { |
|
| 78 | 78 | return redirect()->route('wizard.profile'); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - if($request->session()->has('wiki_callback')){ |
|
| 81 | + if ($request->session()->has('wiki_callback')) { |
|
| 82 | 82 | $user->wiki_token = $request->session()->get('wiki_token'); |
| 83 | 83 | $user->save(); |
| 84 | 84 | $callback = urldecode($request->session()->get('wiki_callback')); |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | public function redirectToProvider(string $provider) |
| 92 | 92 | { |
| 93 | 93 | config(['services.'.$provider.'.redirect' => env(strtoupper($provider).'_CALLBACK')]); |
| 94 | - if($provider === 'twitter'){ |
|
| 94 | + if ($provider === 'twitter') { |
|
| 95 | 95 | return Socialite::driver($provider)->redirect(); |
| 96 | 96 | } |
| 97 | 97 | return Socialite::driver($provider)->redirectUrl(config('services.'.$provider.'.redirect'))->redirect(); |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | $user = User::where('uuid', $userId)->first(); |
| 105 | 105 | $this->guard()->login($user); |
| 106 | 106 | |
| 107 | - if($user->context_id !== null){ |
|
| 107 | + if ($user->context_id !== null) { |
|
| 108 | 108 | $user->wiki_token = $request->session()->get('wiki_token'); |
| 109 | 109 | $user->save(); |
| 110 | 110 | $callback = urldecode($request->session()->get('wiki_callback')); |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | return redirect()->route('wizard.profile'); |
| 115 | - }catch (ValidationException $e) { |
|
| 115 | + } catch (ValidationException $e) { |
|
| 116 | 116 | $attributes = $e->validator->attributes(); |
| 117 | 117 | $attributes['provider'] = $provider; |
| 118 | 118 | return redirect()->route('register-social-network') |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | public function showLoginForm(Request $request) |
| 26 | 26 | { |
| 27 | 27 | session()->reflash(); |
| 28 | - if($request->has('wiki_callback')){ |
|
| 28 | + if ($request->has('wiki_callback')) { |
|
| 29 | 29 | session()->flash('wiki_callback', $request->input('wiki_callback')); |
| 30 | 30 | session()->flash('wiki_token', $request->input('wiki_token')); |
| 31 | 31 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | public function logout(Request $request) |
| 36 | 36 | { |
| 37 | - if($request->session()->has('should_attach_to_organization')) { |
|
| 37 | + if ($request->session()->has('should_attach_to_organization')) { |
|
| 38 | 38 | $shouldAttach = $request->session()->get('should_attach_to_organization'); |
| 39 | 39 | $shouldAttachToken = $request->session()->get('should_attach_to_organization_token'); |
| 40 | 40 | $linkToRedirect = $request->session()->get('should_attach_to_organization_redirect'); |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | $request->session()->regenerateToken(); |
| 48 | 48 | |
| 49 | - if(isset($shouldAttach)){ |
|
| 49 | + if (isset($shouldAttach)) { |
|
| 50 | 50 | $request->session()->flash('should_attach_to_organization', $shouldAttach); |
| 51 | 51 | $request->session()->flash('should_attach_to_organization_token', $shouldAttachToken); |
| 52 | 52 | $request->session()->flash('should_attach_to_organization_redirect', $linkToRedirect); |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | protected function loggedOut(Request $request) |
| 65 | 65 | { |
| 66 | 66 | $request->session()->reflash(); |
| 67 | - if($request->session()->has('should_attach_to_organization')){ |
|
| 67 | + if ($request->session()->has('should_attach_to_organization')) { |
|
| 68 | 68 | $linkToRedirect = $request->session()->get('should_attach_to_organization_redirect'); |
| 69 | 69 | return $request->wantsJson() |
| 70 | 70 | ? new Response('', 204) |
@@ -74,17 +74,17 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | protected function authenticated(Request $request, $user) |
| 76 | 76 | { |
| 77 | - if($user->context_id === null){ |
|
| 77 | + if ($user->context_id === null) { |
|
| 78 | 78 | return redirect()->route('wizard.profile'); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - if($request->session()->has('wiki_callback')){ |
|
| 81 | + if ($request->session()->has('wiki_callback')) { |
|
| 82 | 82 | $user->wiki_token = $request->session()->get('wiki_token'); |
| 83 | 83 | $user->save(); |
| 84 | 84 | $callback = urldecode($request->session()->get('wiki_callback')); |
| 85 | 85 | return redirect($callback); |
| 86 | 86 | } |
| 87 | - if($request->session()->has('should_attach_to_organization') && $request->session()->get('should_attach_to_organization') !== null){ |
|
| 87 | + if ($request->session()->has('should_attach_to_organization') && $request->session()->get('should_attach_to_organization') !== null) { |
|
| 88 | 88 | $token = $request->session()->get('should_attach_to_organization_token'); |
| 89 | 89 | $link = route('organization.invite.show').'?&token='.$token; |
| 90 | 90 | return $request->wantsJson() |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | public function redirectToProvider(string $provider) |
| 98 | 98 | { |
| 99 | - if($provider === 'twitter'){ |
|
| 99 | + if ($provider === 'twitter') { |
|
| 100 | 100 | config(['services.'.$provider.'.redirect' => env(strtoupper($provider).'_CALLBACK_LOGIN')]); |
| 101 | 101 | return Socialite::driver($provider)->redirect(); |
| 102 | 102 | } |