@@ -81,8 +81,9 @@ |
||
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->twoFactorEntity()->getDecryptedSecret(); |
88 | 89 |
@@ -55,8 +55,9 @@ |
||
55 | 55 | */ |
56 | 56 | protected function shouldConfirmPassword(Request $request): bool |
57 | 57 | { |
58 | - if ( ! $this->hasPassword($request)) |
|
59 | - return false; |
|
58 | + if ( ! $this->hasPassword($request)) { |
|
59 | + return false; |
|
60 | + } |
|
60 | 61 | |
61 | 62 | $confirmedAt = time() - $request->session()->get('auth.password_confirmed_at', 0); |
62 | 63 |
@@ -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 | } |
@@ -97,8 +97,9 @@ |
||
97 | 97 | { |
98 | 98 | $url = $this->redirectUrlAfterLogout($request); |
99 | 99 | |
100 | - if ($request->wantsJson()) |
|
101 | - return new Response(['redirect' => $url]); |
|
100 | + if ($request->wantsJson()) { |
|
101 | + return new Response(['redirect' => $url]); |
|
102 | + } |
|
102 | 103 | |
103 | 104 | return redirect()->to($url); |
104 | 105 | } |
@@ -70,7 +70,7 @@ |
||
70 | 70 | |
71 | 71 | if ($code = $request->validRecoveryCode()) { |
72 | 72 | $this->getTwoFactorAuthenticationRepository() |
73 | - ->replaceRecoveryCode($user, $code); |
|
73 | + ->replaceRecoveryCode($user, $code); |
|
74 | 74 | } |
75 | 75 | elseif ( ! $request->hasValidCode()) { |
76 | 76 | return $this->getFailedTwoFactorLoginResponse($request); |
@@ -40,13 +40,15 @@ discard block |
||
40 | 40 | */ |
41 | 41 | protected function form(string $view, Request $request = null) |
42 | 42 | { |
43 | - if (is_null($request)) |
|
44 | - $request = request(); |
|
43 | + if (is_null($request)) { |
|
44 | + $request = request(); |
|
45 | + } |
|
45 | 46 | |
46 | - if (is_null($request->session()->get('login.id'))) |
|
47 | - return redirect()->to( |
|
47 | + if (is_null($request->session()->get('login.id'))) { |
|
48 | + return redirect()->to( |
|
48 | 49 | $this->getFailedTwoFactorRedirectUrl($request) |
49 | 50 | ); |
51 | + } |
|
50 | 52 | |
51 | 53 | $request->session()->reflash(); |
52 | 54 | |
@@ -71,8 +73,7 @@ discard block |
||
71 | 73 | if ($code = $request->validRecoveryCode()) { |
72 | 74 | $this->getTwoFactorAuthenticationRepository() |
73 | 75 | ->replaceRecoveryCode($user, $code); |
74 | - } |
|
75 | - elseif ( ! $request->hasValidCode()) { |
|
76 | + } elseif ( ! $request->hasValidCode()) { |
|
76 | 77 | return $this->getFailedTwoFactorLoginResponse($request); |
77 | 78 | } |
78 | 79 | |
@@ -91,8 +92,9 @@ discard block |
||
91 | 92 | */ |
92 | 93 | protected function getTwoFactorLoginResponse(Request $request, $user) |
93 | 94 | { |
94 | - if ($request->wantsJson()) |
|
95 | - return new Response('', Response::HTTP_NO_CONTENT); |
|
95 | + if ($request->wantsJson()) { |
|
96 | + return new Response('', Response::HTTP_NO_CONTENT); |
|
97 | + } |
|
96 | 98 | |
97 | 99 | return redirect()->to($this->getRedirectUrlAfterLogin($request, $user)); |
98 | 100 | } |
@@ -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)); |
@@ -46,8 +46,9 @@ discard block |
||
46 | 46 | event(new PasswordReset($user)); |
47 | 47 | }); |
48 | 48 | |
49 | - if ($status === Password::PASSWORD_RESET) |
|
50 | - return $this->getSuccessResponse($request, $status); |
|
49 | + if ($status === Password::PASSWORD_RESET) { |
|
50 | + return $this->getSuccessResponse($request, $status); |
|
51 | + } |
|
51 | 52 | |
52 | 53 | return $this->getFailedResponse($request, $status); |
53 | 54 | } |
@@ -82,8 +83,9 @@ discard block |
||
82 | 83 | { |
83 | 84 | $status = trans($status); |
84 | 85 | |
85 | - if ($request->wantsJson()) |
|
86 | - return new JsonResponse(['message' => $status], JsonResponse::HTTP_OK); |
|
86 | + if ($request->wantsJson()) { |
|
87 | + return new JsonResponse(['message' => $status], JsonResponse::HTTP_OK); |
|
88 | + } |
|
87 | 89 | |
88 | 90 | return redirect() |
89 | 91 | ->to($this->getRedirectUrl()) |
@@ -62,8 +62,9 @@ |
||
62 | 62 | { |
63 | 63 | $status = trans($status); |
64 | 64 | |
65 | - if ($request->wantsJson()) |
|
66 | - return new JsonResponse(['message' => trans($status)], JsonResponse::HTTP_OK); |
|
65 | + if ($request->wantsJson()) { |
|
66 | + return new JsonResponse(['message' => trans($status)], JsonResponse::HTTP_OK); |
|
67 | + } |
|
67 | 68 | |
68 | 69 | return redirect() |
69 | 70 | ->back() |
@@ -25,7 +25,7 @@ |
||
25 | 25 | */ |
26 | 26 | protected static function broker(): PasswordBroker |
27 | 27 | { |
28 | - return with(app('auth.password'), function (PasswordBrokerFactory $manager) { |
|
28 | + return with(app('auth.password'), function(PasswordBrokerFactory $manager) { |
|
29 | 29 | return $manager->broker(static::getBrokerDriver()); |
30 | 30 | }); |
31 | 31 | } |
@@ -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 | } |
@@ -187,11 +187,13 @@ discard block |
||
187 | 187 | */ |
188 | 188 | public function passes($attribute, $value): bool |
189 | 189 | { |
190 | - if ($this->requireUppercase && Str::lower($value) === $value) |
|
191 | - return false; |
|
190 | + if ($this->requireUppercase && Str::lower($value) === $value) { |
|
191 | + return false; |
|
192 | + } |
|
192 | 193 | |
193 | - if ($this->requireNumeric && ! preg_match('/[0-9]/', $value)) |
|
194 | - return false; |
|
194 | + if ($this->requireNumeric && ! preg_match('/[0-9]/', $value)) { |
|
195 | + return false; |
|
196 | + } |
|
195 | 197 | |
196 | 198 | return Str::length($value) >= $this->length; |
197 | 199 | } |
@@ -209,11 +211,9 @@ discard block |
||
209 | 211 | |
210 | 212 | if ($this->requireUppercase && ! $this->requireNumeric) { |
211 | 213 | return __('The :attribute must be at least '.$this->length.' characters and contain at least one uppercase character.'); |
212 | - } |
|
213 | - elseif ($this->requireNumeric && ! $this->requireUppercase) { |
|
214 | + } elseif ($this->requireNumeric && ! $this->requireUppercase) { |
|
214 | 215 | return __('The :attribute must be at least '.$this->length.' characters and contain at least one number.'); |
215 | - } |
|
216 | - elseif ($this->requireUppercase && $this->requireNumeric) { |
|
216 | + } elseif ($this->requireUppercase && $this->requireNumeric) { |
|
217 | 217 | return __('The :attribute must be at least '.$this->length.' characters and contain at least one uppercase character and number.'); |
218 | 218 | } |
219 | 219 |