Giter Site home page Giter Site logo

recaptchavalidator's People

Contributors

enoahnetzach avatar ilyapokamestov avatar mbabker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

recaptchavalidator's Issues

Composer post-install/update doesn't work because of missing files

Hello there,

I've started using this bundle today but noticed an issue when Composer runs the post-install/update command as described on the main page.

I am using release 1.0.5, and this is a Symfony 3.1 project.

[Symfony\Component\Filesystem\Exception\FileNotFoundException] Failed to copy "\vendor\dario_swain\re-captcha-validator\src\Composer/../Resources/views/form_div_layout.html.twig" because file does not exist.

I checked in /vendor/dario_swain/re-captcha-validator/src and there is no such Resources folder. Is something not being delivered?

Add driver parameter in ReCaptchaValidator.php

Is it possible to add a driver parameter in ReCaptchaValidator.php like so :

https://github.com/DarioSwain/ReCaptchaValidator/blob/master/src/Validator/ReCaptchaValidator.php

class ReCaptchaValidator extends ConstraintValidator
{
    /** @var Request */
    protected $request;
    /** @var  string */
    protected $privateKey;
    /** @var DriverInterface */
    protected $driver;

    /**
     * @param Request $request
     * @param string $privateKey
     * @param $driver
     */
    public function __construct(Request $request, $privateKey, DriverInterface $driver)
    {
        $this->request = $request;
        $this->privateKey = $privateKey;
        $this->driver = $driver;
    }

    /**
     * {@inheritdoc}
     */
    public function validate($value, Constraint $constraint)
    {
        if(!($constraint instanceof ReCaptchaConstraint))
        {
            throw new InvalidArgumentException('Use ReCaptchaConstraint for ReCaptchaValidator.');
        }

        if($this->request->get('g-recaptcha-response', false))
        {
            $reCaptcha = new ReCaptcha($this->privateKey, $this->request->getClientIp(), $this->request->get('g-recaptcha-response', false));
            $response = $reCaptcha->buildRequest($this->driver)->send();
            if(!$response->isSuccess())
            {
                $this->context->addViolation($constraint->message);
            }
        }
        else
        {
            $this->context->addViolation($constraint->message);
        }
    }
}

The idea is to easily override ds_re_captcha.validator service in your ds-recaptcha-bundle and in my case to add a driver behind my proxy.

Where is the form ? (in 1.0.3)

[Symfony\Component\Filesystem\Exception\FileNotFoundException]
Failed to copy "/home/vagrant/vendor/dario_swain/re-captcha-validator/src/C
omposer/../Resources/views/form_div_layout.html.twig" because file does not
exist.

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.