ilyapokamestov / recaptchavalidator Goto Github PK
View Code? Open in Web Editor NEWGoogle reCaptcha FormType and Validator for Symfony applications
License: MIT License
Google reCaptcha FormType and Validator for Symfony applications
License: MIT License
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?
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.
[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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.