greggilbert / recaptcha

[ABANDONED] reCAPTCHA Validator for Laravel 5
MIT License
714 stars 197 forks source link

g-recaptcha-response is required - but it's not available on the server side; it's empty/null #162

Closed renepardon closed 5 years ago

renepardon commented 5 years ago

Hello,

I've integrated this package but encounter an issue when using it on localhost:8080. The g-recaptcha-response get's filled and sent to the server but it never arrives like all the other parameters. Did you ever had such a behaviour?

I'm using laravel 5.7.

Parameter is sent to the server:

screenshot 2018-11-26 11 08 29

But doesn't appear within POST parameters: (dumped with dd($request->except('password'));)

screenshot 2018-11-26 11 08 35 I've created a LoginRequest class which does the validation and fails because it tells me that g-recaptcha-response is required:

    public function rules()
    {
        $rules = [
            config('access.users.username') => 'required|string',
            'password' => 'required|string',
        ];

        if (setting('login_captcha_enabled')) {
            switch (setting('login_captcha')) {
                case 'recaptcha':
                    $rules['g-recaptcha-response'] = 'required|recaptcha';
                    break;
                case 'captcha':
                    // no break - captcha is the default if none is defined
                default:
                    $rules['captcha'] = 'required|captcha';
            }
        }

        return $rules;
    }
renepardon commented 5 years ago

Just as a side note: the password is just a localhost demo account password ;)

tayyabhussainit commented 4 years ago

@renepardon how did you fix it ?