@@ -40,7 +40,7 @@ |
||
40 | 40 | $socialiteUser = $this->socialiteGateway->user($provider); |
41 | 41 | |
42 | 42 | $user = $this->userRepository->getByProvider($provider, $socialiteUser->providerId()); |
43 | - if($user === null){ |
|
43 | + if ($user === null) { |
|
44 | 44 | app(RegisterUserFromSocialNetworkService::class)->register($provider, $socialiteUser); |
45 | 45 | $user = $this->userRepository->getByProvider($provider, $socialiteUser->providerId()); |
46 | 46 | } |
@@ -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 | } |
@@ -7,7 +7,7 @@ |
||
7 | 7 | { |
8 | 8 | public function get() |
9 | 9 | { |
10 | - return collect([ |
|
10 | + return collect([ |
|
11 | 11 | new WikiUserRole('advisor'), |
12 | 12 | new WikiUserRole('farmer'), |
13 | 13 | new WikiUserRole('student'), |
@@ -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, [ |
@@ -80,16 +80,16 @@ discard block |
||
80 | 80 | protected function registered(Request $request, $user) |
81 | 81 | { |
82 | 82 | $this->guard()->login($user, true); |
83 | - if($request->session()->has('should_attach_to_organization')){ |
|
83 | + if ($request->session()->has('should_attach_to_organization')) { |
|
84 | 84 | app(AttachUserToAnOrganization::class)->attach($user->uuid, $request->session()->get('should_attach_to_organization')); |
85 | 85 | } |
86 | 86 | $user = Auth::user(); |
87 | 87 | |
88 | - if($user->context_id === null) { |
|
88 | + if ($user->context_id === null) { |
|
89 | 89 | return redirect()->route('wizard.profile'); |
90 | 90 | } |
91 | 91 | |
92 | - if($request->session()->has('wiki_callback')){ |
|
92 | + if ($request->session()->has('wiki_callback')) { |
|
93 | 93 | $user->wiki_token = $request->session()->get('wiki_token'); |
94 | 94 | $user->save(); |
95 | 95 | $callback = urldecode($request->session()->get('wiki_callback')); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | public function redirectToProvider(string $provider) |
103 | 103 | { |
104 | 104 | config(['services.'.$provider.'.redirect' => env(strtoupper($provider).'_CALLBACK')]); |
105 | - if($provider === 'twitter'){ |
|
105 | + if ($provider === 'twitter') { |
|
106 | 106 | return Socialite::driver($provider)->redirect(); |
107 | 107 | } |
108 | 108 | return Socialite::driver($provider)->redirectUrl(config('services.'.$provider.'.redirect'))->redirect(); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $user = User::where('uuid', $userId)->first(); |
116 | 116 | $this->guard()->login($user); |
117 | 117 | |
118 | - if($user->context_id !== null){ |
|
118 | + if ($user->context_id !== null) { |
|
119 | 119 | $user->wiki_token = $request->session()->get('wiki_token'); |
120 | 120 | $user->save(); |
121 | 121 | $callback = urldecode($request->session()->get('wiki_callback')); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | } |
124 | 124 | |
125 | 125 | return redirect()->route('wizard.profile'); |
126 | - }catch (ValidationException $e) { |
|
126 | + } catch (ValidationException $e) { |
|
127 | 127 | $attributes = $e->validator->attributes(); |
128 | 128 | $attributes['provider'] = $provider; |
129 | 129 | 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(), |
@@ -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')); |
@@ -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 | } |
@@ -24,10 +24,10 @@ 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 | - if($request->has('wiki_callback')){ |
|
30 | + if ($request->has('wiki_callback')) { |
|
31 | 31 | session()->flash('wiki_callback', $request->input('wiki_callback')); |
32 | 32 | session()->flash('wiki_token', $request->input('wiki_token')); |
33 | 33 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | public function logout(Request $request) |
38 | 38 | { |
39 | - if($request->session()->has('should_attach_to_organization')) { |
|
39 | + if ($request->session()->has('should_attach_to_organization')) { |
|
40 | 40 | $shouldAttach = $request->session()->get('should_attach_to_organization'); |
41 | 41 | $shouldAttachToken = $request->session()->get('should_attach_to_organization_token'); |
42 | 42 | $linkToRedirect = $request->session()->get('should_attach_to_organization_redirect'); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | $request->session()->regenerateToken(); |
50 | 50 | |
51 | - if(isset($shouldAttach)){ |
|
51 | + if (isset($shouldAttach)) { |
|
52 | 52 | $request->session()->flash('should_attach_to_organization', $shouldAttach); |
53 | 53 | $request->session()->flash('should_attach_to_organization_token', $shouldAttachToken); |
54 | 54 | $request->session()->flash('should_attach_to_organization_redirect', $linkToRedirect); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | protected function loggedOut(Request $request) |
67 | 67 | { |
68 | 68 | $request->session()->reflash(); |
69 | - if($request->session()->has('should_attach_to_organization')){ |
|
69 | + if ($request->session()->has('should_attach_to_organization')) { |
|
70 | 70 | $linkToRedirect = $request->session()->get('should_attach_to_organization_redirect'); |
71 | 71 | return $request->wantsJson() |
72 | 72 | ? new Response('', 204) |
@@ -76,17 +76,17 @@ discard block |
||
76 | 76 | |
77 | 77 | protected function authenticated(Request $request, $user) |
78 | 78 | { |
79 | - if($user->context_id === null){ |
|
79 | + if ($user->context_id === null) { |
|
80 | 80 | return redirect()->route('wizard.profile'); |
81 | 81 | } |
82 | 82 | |
83 | - if($request->session()->has('wiki_callback')){ |
|
83 | + if ($request->session()->has('wiki_callback')) { |
|
84 | 84 | $user->wiki_token = $request->session()->get('wiki_token'); |
85 | 85 | $user->save(); |
86 | 86 | $callback = urldecode($request->session()->get('wiki_callback')); |
87 | 87 | return redirect($callback); |
88 | 88 | } |
89 | - if($request->session()->has('should_attach_to_organization') && $request->session()->get('should_attach_to_organization') !== null){ |
|
89 | + if ($request->session()->has('should_attach_to_organization') && $request->session()->get('should_attach_to_organization') !== null) { |
|
90 | 90 | $token = $request->session()->get('should_attach_to_organization_token'); |
91 | 91 | $link = route('organization.invite.show').'?&token='.$token; |
92 | 92 | return $request->wantsJson() |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | public function redirectToProvider(string $provider) |
100 | 100 | { |
101 | - if($provider === 'twitter'){ |
|
101 | + if ($provider === 'twitter') { |
|
102 | 102 | config(['services.'.$provider.'.redirect' => env(strtoupper($provider).'_CALLBACK_LOGIN')]); |
103 | 103 | return Socialite::driver($provider)->redirect(); |
104 | 104 | } |