@@ -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 | } |
@@ -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()) |
@@ -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 |
@@ -144,8 +144,7 @@ |
||
144 | 144 | })->can(function () use ($user) { |
145 | 145 | return UsersPolicy::can('deactivate', [$user]); |
146 | 146 | })->asIcon(); |
147 | - } |
|
148 | - else { |
|
147 | + } else { |
|
149 | 148 | $actions[] = Action::button('activate', 'Activate', function () use ($user) { |
150 | 149 | return "ARCANESOFT.emit('authorization::users.activate', {id: '{$user->getRouteKey()}'})"; |
151 | 150 | })->can(function () use ($user) { |
@@ -143,8 +143,7 @@ |
||
143 | 143 | })->can(function () use ($administrator) { |
144 | 144 | return AdministratorsPolicy::can('deactivate', [$administrator]); |
145 | 145 | })->asIcon(); |
146 | - } |
|
147 | - else { |
|
146 | + } else { |
|
148 | 147 | $actions[] = Action::button('activate', 'Activate', function () use ($administrator) { |
149 | 148 | return "ARCANESOFT.emit('authorization::administrators.activate', {id: '{$administrator->getRouteKey()}'})"; |
150 | 149 | })->can(function () use ($administrator) { |
@@ -109,8 +109,7 @@ |
||
109 | 109 | })->can(function () use ($role) { |
110 | 110 | return PasswordResetsPolicy::can('deactivate', [$role]); |
111 | 111 | })->asIcon(); |
112 | - } |
|
113 | - else { |
|
112 | + } else { |
|
114 | 113 | $actions[] = Action::button('activate', 'Activate', function () use ($role) { |
115 | 114 | return "ARCANESOFT.emit('authorization::roles.activate', {id: '{$role->getRouteKey()}'})"; |
116 | 115 | })->can(function () use ($role) { |