Contact form gcaptcha wrong validate: v6.x
animepain opened this issue · 2 comments
Sorry for my bad english,
The server side validate of contact form is wrong when you use require_if:
return [ 'name' => ['required'], 'email' => ['required', 'email'], 'message' => ['required'], 'g-recaptcha-response' => ['required_if:captcha_status,true', 'captcha'], ];
It will validate only if the captcha_status is set to true. If you modify it and set to false, you can send contact without validate the captcha.
Not quite sure if this will help? Is captcha_status in .env?
$rules= ['name' => ['required'], 'email' => ['required', 'email'], 'message' => ['required'], ];
if (env('captcha_status', false)) {
$rules['g-recaptcha-response'] = ['required', 'captcha'], ];
}
return $rules;
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.