Code Monkey home page Code Monkey logo

recaptcha-extension's Introduction

recaptcha-extension

PyroCMS - Recaptcha Field Type

Usage

Just include this into your FormBuilder

protected $options = [
    'captcha' => true
];

And configure your ReCaptcha keys in your env file

NOCAPTCHA_SITEKEY=[yoursitekey]
NOCAPTCHA_SECRET=[yoursecret]

recaptcha-extension's People

Contributors

agustindidiego avatar

Stargazers

Jared Thomas avatar William Åström avatar

Watchers

James Cloos avatar Aaron Peachey avatar William Åström avatar

Forkers

pixney-william

recaptcha-extension's Issues

Can't get captcha to appear

I was curious to get a captcha to appear on the contact form plugin in PyroCMS, but I can't get anything to output from this extension. Any guidance on getting the captcha to appear on the contact form?

Can't run RecaptchaValidator

Hello, I wondered that I found this extension, thank you!

I have some small issue while integration it into my site.

When I add RecaptchaValidator into my validators of the form field:

.......
                        'validators' => [
                            'captcha' => [
                                'handler' => RecaptchaValidator::class,
                                'message' => 'The date/time format is invalid.',
                            ],
                        ],
........

I get this error:

Unresolvable dependency resolving [Parameter #0 [ <required> $secret ]] in class Anhskohbo\NoCaptcha\NoCaptcha

it seems it related to injection in NoCaptcha construct method:

	public function __construct(NoCaptcha $captcha, Request $request)
	{
		$this->captcha = $captcha;
		$this->request = $request;
	}

I've tried to remove it and set $this->captcha = app('captcha') but then I get false from verifyResponse method:

    public function verifyResponse($response, $clientIp = null)
    {
        if (empty($response)) {
            return false;
        }

        // Return true if response already verfied before.
        if (in_array($response, $this->verifiedResponses)) {
            return true;
        }

        $verifyResponse = $this->sendRequestVerify([
            'secret' => $this->secret,
            'response' => $response,
            'remoteip' => $clientIp,
        ]);


        if (isset($verifyResponse['success']) && $verifyResponse['success'] === true) {
            // A response can only be verified once from google, so we need to
            // cache it to make it work in case we want to verify it multiple times.
            $this->verifiedResponses[] = $response;
            return true;
        } else {
            return false;
        }
    }

this method returns:

^ array:2 [▼
  "success" => false
  "error-codes" => array:1 [▼
    0 => "invalid-input-response"
  ]
]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.