Fix request validation in login and register pages

This commit is contained in:
DariusIII
2023-03-30 23:00:23 +02:00
parent ad05688ac6
commit 8435584917
3 changed files with 13 additions and 8 deletions
@@ -129,8 +129,6 @@ class RegisterController extends Controller
'password' => ['required', 'confirmed', Password::min(8)->letters()->mixedCase()->numbers()->symbols()->uncompromised()],
]);
if (config('captcha.enabled') === true && (! empty(config('captcha.secret')) && ! empty(config('captcha.sitekey')))) {
}
if ($validator->fails()) {
$error = implode('', Arr::collapse($validator->errors()->toArray()));
@@ -18,6 +18,8 @@ class LoginLoginRequest extends FormRequest
'captcha',
],
];
} else {
return [];
}
}
}
@@ -11,11 +11,16 @@ class RegisterRegisterRequest extends FormRequest
*/
public function rules(): array
{
return [
'g-recaptcha-response' => [
'required',
'captcha',
],
];
if (config('captcha.enabled') === true && (! empty(config('captcha.secret')) && ! empty(config('captcha.sitekey')))) {
return [
'g-recaptcha-response' => [
'required',
'captcha',
],
];
} else {
return [];
}
}
}