@@ -72,8 +72,9 @@ |
||
72 | 72 | */ |
73 | 73 | public function verified($date = null): self |
74 | 74 | { |
75 | - if (is_null($date)) |
|
76 | - $date = now(); |
|
75 | + if (is_null($date)) { |
|
76 | + $date = now(); |
|
77 | + } |
|
77 | 78 | |
78 | 79 | return $this->state([ |
79 | 80 | 'email_verified_at' => $date === false ? null : $date, |
@@ -41,8 +41,9 @@ discard block |
||
41 | 41 | { |
42 | 42 | $status = $this->broker()->sendResetLink($credentials); |
43 | 43 | |
44 | - if ($status === PasswordBroker::RESET_LINK_SENT) |
|
45 | - return $this->getSuccessResponse($request, $status); |
|
44 | + if ($status === PasswordBroker::RESET_LINK_SENT) { |
|
45 | + return $this->getSuccessResponse($request, $status); |
|
46 | + } |
|
46 | 47 | |
47 | 48 | return $this->getFailedResponse($request, $status); |
48 | 49 | } |
@@ -62,8 +63,9 @@ discard block |
||
62 | 63 | { |
63 | 64 | $status = trans($status); |
64 | 65 | |
65 | - if ($request->wantsJson()) |
|
66 | - return new JsonResponse(['message' => trans($status)], JsonResponse::HTTP_OK); |
|
66 | + if ($request->wantsJson()) { |
|
67 | + return new JsonResponse(['message' => trans($status)], JsonResponse::HTTP_OK); |
|
68 | + } |
|
67 | 69 | |
68 | 70 | return redirect() |
69 | 71 | ->back() |
@@ -82,10 +84,11 @@ discard block |
||
82 | 84 | { |
83 | 85 | $status = trans($status); |
84 | 86 | |
85 | - if ($request->wantsJson()) |
|
86 | - throw ValidationException::withMessages([ |
|
87 | + if ($request->wantsJson()) { |
|
88 | + throw ValidationException::withMessages([ |
|
87 | 89 | 'email' => $status, |
88 | 90 | ]); |
91 | + } |
|
89 | 92 | |
90 | 93 | return redirect() |
91 | 94 | ->back() |
@@ -82,8 +82,9 @@ |
||
82 | 82 | */ |
83 | 83 | protected function getRegisteredResponse(Request $request, $user) |
84 | 84 | { |
85 | - if ($request->wantsJson()) |
|
86 | - new Response('', Response::HTTP_CREATED); |
|
85 | + if ($request->wantsJson()) { |
|
86 | + new Response('', Response::HTTP_CREATED); |
|
87 | + } |
|
87 | 88 | |
88 | 89 | return redirect()->to($this->redirectUrlAfterRegister($request, $user)); |
89 | 90 | } |
@@ -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 | } |
@@ -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 | } |