@@ -41,7 +41,7 @@ |
||
41 | 41 | return (new Pipeline(app())) |
42 | 42 | ->send($request) |
43 | 43 | ->through($actions) |
44 | - ->then(function ($request) { |
|
44 | + ->then(function($request) { |
|
45 | 45 | return $this->getLoginResponse($request); |
46 | 46 | }); |
47 | 47 | } |
@@ -96,8 +96,9 @@ |
||
96 | 96 | { |
97 | 97 | $url = $this->redirectUrlAfterLogout($request); |
98 | 98 | |
99 | - if ($request->wantsJson()) |
|
100 | - return new JsonResponse(['redirect' => $url]); |
|
99 | + if ($request->wantsJson()) { |
|
100 | + return new JsonResponse(['redirect' => $url]); |
|
101 | + } |
|
101 | 102 | |
102 | 103 | return redirect()->to($url); |
103 | 104 | } |
@@ -40,7 +40,7 @@ |
||
40 | 40 | */ |
41 | 41 | protected function resetPassword(Request $request, array $credentials) |
42 | 42 | { |
43 | - $status = $this->broker()->reset($credentials, function ($user, $password) use ($request) { |
|
43 | + $status = $this->broker()->reset($credentials, function($user, $password) use ($request) { |
|
44 | 44 | $this->updatePassword($user, $password); |
45 | 45 | |
46 | 46 | event(new PasswordReset($user)); |
@@ -81,8 +81,9 @@ |
||
81 | 81 | { |
82 | 82 | $status = trans($status); |
83 | 83 | |
84 | - if ($request->wantsJson()) |
|
85 | - return new JsonResponse(['message' => $status], JsonResponse::HTTP_OK); |
|
84 | + if ($request->wantsJson()) { |
|
85 | + return new JsonResponse(['message' => $status], JsonResponse::HTTP_OK); |
|
86 | + } |
|
86 | 87 | |
87 | 88 | return redirect() |
88 | 89 | ->to($this->getRedirectUrl()) |
@@ -44,10 +44,10 @@ discard block |
||
44 | 44 | public function pluck(string $key): array |
45 | 45 | { |
46 | 46 | return Collection::make($this->modules()) |
47 | - ->filter(function ($module) use ($key) { |
|
47 | + ->filter(function($module) use ($key) { |
|
48 | 48 | return isset($module[$key]); |
49 | 49 | }) |
50 | - ->mapWithKeys(function ($module, $name) use ($key) { |
|
50 | + ->mapWithKeys(function($module, $name) use ($key) { |
|
51 | 51 | return [$name => $module[$key]]; |
52 | 52 | }) |
53 | 53 | ->toArray(); |
@@ -71,13 +71,13 @@ discard block |
||
71 | 71 | |
72 | 72 | $this->write( |
73 | 73 | Collection::make($packages) |
74 | - ->mapWithKeys(function ($package) { |
|
74 | + ->mapWithKeys(function($package) { |
|
75 | 75 | return [$this->format($package['name']) => $package['extra']['arcanesoft'] ?? []]; |
76 | 76 | }) |
77 | - ->each(function ($configuration) use (&$ignore) { |
|
77 | + ->each(function($configuration) use (&$ignore) { |
|
78 | 78 | $ignore = array_merge($ignore, $configuration['dont-discover'] ?? []); |
79 | 79 | }) |
80 | - ->reject(function ($configuration, $package) use ($ignore, $ignoreAll) { |
|
80 | + ->reject(function($configuration, $package) use ($ignore, $ignoreAll) { |
|
81 | 81 | return $ignoreAll || in_array($package, $ignore); |
82 | 82 | }) |
83 | 83 | ->filter() |
@@ -41,13 +41,15 @@ discard block |
||
41 | 41 | */ |
42 | 42 | protected function form(string $view, Request $request = null) |
43 | 43 | { |
44 | - if (is_null($request)) |
|
45 | - $request = request(); |
|
44 | + if (is_null($request)) { |
|
45 | + $request = request(); |
|
46 | + } |
|
46 | 47 | |
47 | - if (is_null($request->session()->get('login.id'))) |
|
48 | - return redirect()->to( |
|
48 | + if (is_null($request->session()->get('login.id'))) { |
|
49 | + return redirect()->to( |
|
49 | 50 | $this->getFailedTwoFactorRedirectUrl($request) |
50 | 51 | ); |
52 | + } |
|
51 | 53 | |
52 | 54 | $request->session()->reflash(); |
53 | 55 | |
@@ -72,8 +74,7 @@ discard block |
||
72 | 74 | if ($code = $request->validRecoveryCode()) { |
73 | 75 | $this->getTwoFactorAuthenticationRepository() |
74 | 76 | ->replaceRecoveryCode($user, $code); |
75 | - } |
|
76 | - elseif ( ! $request->hasValidCode()) { |
|
77 | + } elseif ( ! $request->hasValidCode()) { |
|
77 | 78 | return $this->getFailedTwoFactorLoginResponse($request); |
78 | 79 | } |
79 | 80 | |
@@ -92,8 +93,9 @@ discard block |
||
92 | 93 | */ |
93 | 94 | protected function getTwoFactorLoginResponse(Request $request, $user) |
94 | 95 | { |
95 | - if ($request->wantsJson()) |
|
96 | - return new JsonResponse('', JsonResponse::HTTP_NO_CONTENT); |
|
96 | + if ($request->wantsJson()) { |
|
97 | + return new JsonResponse('', JsonResponse::HTTP_NO_CONTENT); |
|
98 | + } |
|
97 | 99 | |
98 | 100 | return redirect()->to($this->getRedirectUrlAfterLogin($request, $user)); |
99 | 101 | } |
@@ -92,8 +92,9 @@ discard block |
||
92 | 92 | */ |
93 | 93 | protected function shouldUseTwoFactor($user): bool |
94 | 94 | { |
95 | - if ( ! Auth::isTwoFactorEnabled()) |
|
96 | - return false; |
|
95 | + if ( ! Auth::isTwoFactorEnabled()) { |
|
96 | + return false; |
|
97 | + } |
|
97 | 98 | |
98 | 99 | return optional($user)->isTwoFactorEnabled() |
99 | 100 | && in_array(HasTwoFactorAuthentication::class, class_uses_recursive($user)); |
@@ -134,8 +135,9 @@ discard block |
||
134 | 135 | 'login.remember' => $request->filled('remember') |
135 | 136 | ]); |
136 | 137 | |
137 | - if ($request->wantsJson()) |
|
138 | - return new JsonResponse(['two_factor' => true]); |
|
138 | + if ($request->wantsJson()) { |
|
139 | + return new JsonResponse(['two_factor' => true]); |
|
140 | + } |
|
139 | 141 | |
140 | 142 | return redirect()->to($this->getTwoFactorUrl($request)); |
141 | 143 | } |
@@ -67,8 +67,9 @@ discard block |
||
67 | 67 | $saved = $twoFactor->save(); |
68 | 68 | event(new EnabledTwoFactor($user)); |
69 | 69 | |
70 | - if ($saved) |
|
71 | - $user->refresh(); |
|
70 | + if ($saved) { |
|
71 | + $user->refresh(); |
|
72 | + } |
|
72 | 73 | |
73 | 74 | return $saved; |
74 | 75 | } |
@@ -88,8 +89,9 @@ discard block |
||
88 | 89 | $deleted = $twoFactor->delete(); |
89 | 90 | event(new EnablingTwoFactor($user)); |
90 | 91 | |
91 | - if ($deleted) |
|
92 | - $user->refresh(); |
|
92 | + if ($deleted) { |
|
93 | + $user->refresh(); |
|
94 | + } |
|
93 | 95 | |
94 | 96 | return $deleted; |
95 | 97 | } |
@@ -81,8 +81,9 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function hasValidCode(): bool |
83 | 83 | { |
84 | - if (is_null($this->code)) |
|
85 | - return false; |
|
84 | + if (is_null($this->code)) { |
|
85 | + return false; |
|
86 | + } |
|
86 | 87 | |
87 | 88 | $secret = $this->twoFactor()->decrypted_secret; |
88 | 89 | |
@@ -110,16 +111,19 @@ discard block |
||
110 | 111 | */ |
111 | 112 | public function challengedUser(): ?HasTwoFactor |
112 | 113 | { |
113 | - if ($this->challengedUser) |
|
114 | - return $this->challengedUser; |
|
114 | + if ($this->challengedUser) { |
|
115 | + return $this->challengedUser; |
|
116 | + } |
|
115 | 117 | |
116 | 118 | $model = $this->guard()->getProvider()->getModel(); |
117 | 119 | |
118 | - if ( ! $this->session()->has('login.id')) |
|
119 | - return null; |
|
120 | + if ( ! $this->session()->has('login.id')) { |
|
121 | + return null; |
|
122 | + } |
|
120 | 123 | |
121 | - if ( ! $user = $model::find($this->session()->pull('login.id'))) |
|
122 | - return null; |
|
124 | + if ( ! $user = $model::find($this->session()->pull('login.id'))) { |
|
125 | + return null; |
|
126 | + } |
|
123 | 127 | |
124 | 128 | return $this->challengedUser = $user; |
125 | 129 | } |
@@ -39,8 +39,9 @@ |
||
39 | 39 | { |
40 | 40 | $confirmed = $this->confirmCredentials($request); |
41 | 41 | |
42 | - if ( ! $confirmed) |
|
43 | - return $this->getFailedResponse($request); |
|
42 | + if ( ! $confirmed) { |
|
43 | + return $this->getFailedResponse($request); |
|
44 | + } |
|
44 | 45 | |
45 | 46 | $request->session()->put($this->sessionKey(), time()); |
46 | 47 |
@@ -58,7 +58,7 @@ |
||
58 | 58 | $value = null, |
59 | 59 | ?string $label = null, |
60 | 60 | bool $grouped = false |
61 | - ){ |
|
61 | + ) { |
|
62 | 62 | |
63 | 63 | $this->options = $options; |
64 | 64 | $this->name = $name; |