RyanDaDeng / laravel-google-recaptcha-v3

It's probably the best Laravel Package for Google reCAPTCHA v3. Vue component supported.
MIT License
275 stars 40 forks source link

Error: The action is timeout. #78

Open kallefrombosnia opened 3 years ago

kallefrombosnia commented 3 years ago

Hello, I have a problem with this error.

I checked every issue here and all of them are timeouts after 2 minutes of page loading, but for me, the problem occurs after page load < 2 minutes. More precisely seconds after js load and submit.

Laravel 8, PHP 7.3.7 My controller:

class ReservationController extends Controller
{
    public function createReservation(Request $request){

         // Here validation fails with timeout message
        $request->validate([
            'room' => 'required|exists:rooms,id',
            'email' => 'required|email',
            'phone' => 'required|max:128',
            'dateReservation' => ['required', new DateInPastCheck, new DateArrivalLeaveCheck],
            'name' => 'required|string|min:3|max:150',
            'g-recaptcha-response' => [new GoogleReCaptchaV3ValidationRule('order')],
        ]);

       // ...
    }
}

But when I test before request validation everything passes normally.

class ReservationController extends Controller
{
    public function createReservation(Request $request){

        dd(GoogleReCaptchaV3::verifyResponse(
            $request->input('g-recaptcha-response'),
            $request->getClientIp()
            )
         ->getMessage());

        // ....
    }
}
w99910 commented 3 years ago

I got the same issue. Can I know if someone has solution ?

nolros commented 3 years ago

Need to run this.$refs.captcha.execute(); after the response (success or error) otherwise you are submitting the same token.

nausixkiz commented 2 years ago

I got the same issue. Is there anyway to solve this problem with javascript instead of vue ? I have tried

    <script type="text/javascript">
        setInterval(function () {
            refreshReCaptchaV3('sign_in_id', 'sign_in');
        }, 120000);
    </script>

but this still happen