reCAPTCHA
reCAPTCHA is a free service from Google that helps protect websites from spam and abuse. A “CAPTCHA” is a turing test to tell human and bots apart. It is easy for humans to solve, but hard for “bots” and other malicious software to figure out. By adding reCAPTCHA to a site, you can block automated software while helping your welcome users to enter with ease.
reCAPTCHA constants in .env
ENABLE_RECAPTCHA=false // true | false
RECAPTCHAV2_SITE_KEY=6LeeLDohAAAAAKe3OWWoL9-Jvmc00fB3OMhqB8dO
RECAPTCHAV2_SECRET_KEY=6LeeLDohAAAAADb4XE1lsqEt3FlLGyg0noNxjEgT
ReCaptchaConfig
rules file (Modules\Common\app\Rules\Recaptcha.php
)
reCaptcha config file (Modules\Common\resources\views\__partial\recaptcha.blade.php
)
@if (env('ENABLE_RECAPTCHA', false))
@pushOnce('page_scripts')
<script type="text/javascript">
var onloadCallback = function() {
grecaptcha.render('recaptcha_element', {
'sitekey': '{{ env('RECAPTCHAV2_SITE_KEY', '') }}'
});
};
</script>
<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit" async defer></script>
@endPushOnce
@endif
?>
reCaptcha config file should include in index.blade.php
@include('common::__partial.recaptcha')