greggilbert/recaptcha

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

renepardon opened this issue · 2 comments

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;
    }

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

@renepardon how did you fix it ?