Made it possible to disable captcha.

This commit is contained in:
2024-07-26 22:13:14 +05:00
parent a5e3c5ed25
commit 8bc4c0d8d0
7 changed files with 40 additions and 14 deletions

View File

@@ -19,7 +19,9 @@ final class AuthController extends Controller
public function login(): View
{
return view('login');
return view('login', [
'captcha' => config('app.captcha', false),
]);
}
public function authorization(AuthorizationRequest $request): RedirectResponse

View File

@@ -13,12 +13,17 @@ final class AuthorizationRequest extends FormRequest implements FormRequestDto
*/
public function rules(): array
{
return [
$rules = [
'email' => ['required', 'email', 'max:255'],
'password' => ['required', 'min:3'],
'captcha-verified' => ['captcha'],
'remember' => ['nullable', 'boolean'],
];
if (config('app.captcha', false)) {
$rules['captcha-verified'] = ['captcha'];
}
return $rules;
}
public function getDto(): Authorization

View File

@@ -32,12 +32,17 @@ final class SendRequest extends FormRequest implements FormRequestDto
*/
public function rules(): array
{
return [
$rules = [
'name' => ['nullable', 'string', 'max:255'],
'email' => ['nullable', 'string', 'max:255', 'email'],
'message' => ['required', 'string', 'max:5000'],
'captcha-verified' => ['captcha'],
];
if (config('app.captcha', false)) {
$rules['captcha-verified'] = ['captcha'];
}
return $rules;
}
public function getDto(): Send