@@ -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 | } |
@@ -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'), |
@@ -11,10 +11,10 @@ |
||
11 | 11 | public function handle($request, \Closure $next) |
12 | 12 | { |
13 | 13 | $user = Auth::user(); |
14 | - if($user->exploitation_id === null){ |
|
14 | + if ($user->exploitation_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,11 +69,11 @@ 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 | |
76 | - if($request->session()->has('wiki_callback')){ |
|
76 | + if ($request->session()->has('wiki_callback')) { |
|
77 | 77 | $user = Auth::user(); |
78 | 78 | $user->wiki_token = $request->session()->get('wiki_token'); |
79 | 79 | $user->save(); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | public function redirectToProvider(string $provider) |
86 | 86 | { |
87 | 87 | config(['services.'.$provider.'.redirect' => env(strtoupper($provider).'_CALLBACK')]); |
88 | - if($provider === 'twitter'){ |
|
88 | + if ($provider === 'twitter') { |
|
89 | 89 | return Socialite::driver($provider)->redirect(); |
90 | 90 | } |
91 | 91 | return Socialite::driver($provider)->redirectUrl(config('services.'.$provider.'.redirect'))->redirect(); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $user = User::where('uuid', $userId)->first(); |
99 | 99 | $this->guard()->login($user); |
100 | 100 | |
101 | - if($user->exploitation_id !== null){ |
|
101 | + if ($user->exploitation_id !== null) { |
|
102 | 102 | $user->wiki_token = $request->session()->get('wiki_token'); |
103 | 103 | $user->save(); |
104 | 104 | $callback = urldecode($request->session()->get('wiki_callback')); |
@@ -106,7 +106,7 @@ discard block |
||
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') |
@@ -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') |
@@ -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->exploitation_id === null){ |
|
77 | + if ($user->exploitation_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 | } |
@@ -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)); |