albertcht / invisible-recaptcha Goto Github PK
View Code? Open in Web Editor NEWAn invisible reCAPTCHA package for Laravel, Lumen, CI or native PHP.
License: MIT License
An invisible reCAPTCHA package for Laravel, Lumen, CI or native PHP.
License: MIT License
Hello Sir,
On laravel 5.4 it was running fine but on 5.5 i get this error .
It relates tho the following code:
I think i will help you out with this and also add overwritable views for this project. I need this because in 5.4 it hindered me because the javascript was loaded of http while it should be :// so the browser can deside it self.
My badge shows in the bottom corner of the page, so I assume it's working correctly. However, I'd like to make it fail on purpose so I can see what happens. Is this possible? I'm using Laravel 5.5.
Thank you for this package! :)
What is the purpose of "https://cdn.polyfill.io/v2/polyfill.min.js" ?
I noticed on the polyfill.js site that it is no longer maintained. Can I safely comment the following to remove the need for polyfill.min.js?
$html = '<script src="' . $this->getPolyfillJs() . '"></script>' . PHP_EOL;"
unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
Like required, pattern, etc.
Possible Solution: listen event _captchaForm.submit()
instead of _captchaSubmit.click()
i try to put the recaptha to registration and that not works with it
Is there a way to test recaptcha using unit testing? Thanks.
Use PHP_EOL instead of "\n" in InvisibleReCaptcha.php
for better OS compatibility.
Hello There,
I was trying to hide the badge on the bottom right but it didnt work like i wanted it to. Here is my .env file.
And this is what i see in my frontend.
In blade im using this.
The HTML you output is correct look at this.
Im not 100% sure how but when i inspect the badge winch has class .grecaptcha-badge indeed. The style from the class is never applied to it. I don't understand why because the i have no other classes named .grecaptcha-badge and i don't ajax load any html or css code for styles and the captcha is loaded with the page by default.
Just thinking might it be a race condition where the class in css is defined but the object is rendered via javascript later. It should not be i know because the css is defined before the badge is rendered but it still comes to mind ..
OR !! When the javascript renders it importants and other css rule show the badge and that will over write your display: none rule. That must be it i think .. You can fix that with javascript and maybe add a section to your views and tell the users to yield the javascript code in the footer. Im going to test this now ..
Okey i got most working now with css but it still has a border like this
iframe[src^="https://www.google.com/recaptcha/api2/anchor"] {
visibility: hidden;
}
This hides the badge BUT does not hide its border .. we need to investigate more.
I just figured it out to hide both the iframe internals and the border you need this javascript code. After the document loaded (so the iframe == the loaded as well)..
We need to do the below code because google adds inline style properties to the .grecaptcha-badge element. We could do without it if a stylesheet would be loaded after the DOM is ready but right now we cant so we need some javascript (so sad).
document.addEventListener('DOMContentLoaded', function () {
let box = document.querySelector('.grecaptcha-badge');
box.style.boxShadow = 'none'
});
This will hide the google Recaptcha box 100%. It might be as well that you also set a display as none (or visibilty:hidden) as that value on document ready. i Think the code evaluated singe you wrote it.. So its one ore the other both do it via javascript or half on half ..
Thanks for listening .. sleep well have a good day ..
Johnny Mast...
i got this error cURL error 60: SSL certificate problem: unable to get local issuer certificate. its related to gazzlehttp handle, but i've tried all version of gazzle still getting error
Hello again,
Invoking the invisible reCAPTCHA challenge after client side validation. I want to know if this can be done from within your package ?
https://developers.google.com/recaptcha/docs/invisible
, I tried the example at the bottom of the page but it is not triggering my client side validation.. I am using Parsley.js with the floating lables example for my validation. Just need to know if we can call the challenge via javascript other than the render() or @captcha() events.
Laravel: 5.4
invisible-recaptcha: "dev-master@dev";
with package: https://github.com/proengsoft/laravel-jsvalidation
Using laravel-jsvalidation, when clicking the submit button the form is sent, even the fields are required. If I comment on the invisible-recaptcha code, the form behaves normally.
Hi, thanks for you sweet package.
Can we provide a way to disable this in tests? I tried the following:
app('captcha')->shouldReceive('verifyRequest')->andReturn(true);
but for some reason I'm getting:
call to undefined method shouldReceive()
I don't get it, because InvisibleReCaptcha extends Facade
, so it should have that method. Any advice? For now, I did a nasty trick:
$this->app['validator']->extend('captcha', function () { return true; });
There's a scenario where I have two forms on a page. I want to protect both the forms with invisible captcha. Both forms are hidden as the page loads and are displayed in a lightbox on a user action. How do I use this plugin in this case?
Hello!
Is there a easy, or not so easy, way to make recaptcha work with ajax forms where data is posted using axios library?
I'm using invisible captcha in a lumen API but it always returns with validation.captcha
error.Can you suggest anything
Hello, I'm using your recaptcha class and it works well, great work! However I'm trying to use it on my website. To be more specific, I'm using it inside a bootstrap modal and the captcha works but the captcha label is aligned weird. Like it's buggin back and forth at the right border of the modal. I thought it will fix inside the normal page body like in the right corner. I know I can hide it but the biggest problem is, that the page speed is stroooongly reduced by using recaptcha. Is there any style inside your class where I can float / align the google label to another place? I've red that the reason cames from using a model.
Hi, it seems the INVISIBLE_RECAPTCHA_BADGEHIDE env is doing nothing.
my .env:
INVISIBLE_RECAPTCHA_SITEKEY=my_key
INVISIBLE_RECAPTCHA_SECRETKEY=my_key
INVISIBLE_RECAPTCHA_BADGEHIDE=true
INVISIBLE_RECAPTCHA_DEBUG=false
my form:
`
/* ... */
{!! app('captcha')->render(LaravelLocalization::getCurrentLocale()) !!}
/* ... */
<button type="submit" class="btn btn-primary btn-rounded">
submit
</button>
Getting the following issue when trying to install on the latest Laravel 5.5
Problem 1
- Installation request for albertcht/invisible-recaptcha ^1.4 -> satisfiable by albertcht/invisible-recaptcha[v1.4].
- Conclusion: remove laravel/framework 5.5.x-dev
- Conclusion: don't install laravel/framework 5.5.x-dev
- albertcht/invisible-recaptcha v1.4 requires illuminate/support 5.0.*|5.1.*|5.2.*|5.3.*|5.4.* -> satisfiable by laravel/framework[5.4.x-dev], illuminate/support[5.0.x-dev, 5.1.x-dev, 5.2.x-dev, 5.3.x-dev, 5.4.x-dev, v5.0.0, v5.0.22, v5.0.25, v5.0.26, v5.0.28, v5.0.33, v5.0.4, v5.1.1, v5.1.13, v5.1.16, v5.1.2, v5.1.20, v5.1.22, v5.1.25, v5.1.28, v5.1.30, v5.1.31, v5.1.41, v5.1.6, v5.1.8, v5.2.0, v5.2.19, v5.2.21, v5.2.24, v5.2.25, v5.2.26, v5.2.27, v5.2.28, v5.2.31, v5.2.32, v5.2.37, v5.2.43, v5.2.45, v5.2.6, v5.2.7, v5.3.0, v5.3.16, v5.3.23, v5.3.4, v5.4.0, v5.4.13, v5.4.17, v5.4.19, v5.4.27, v5.4.9].
- Can only install one of: laravel/framework[5.4.x-dev, 5.5.x-dev].
- don't install illuminate/support 5.1.x-dev|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support 5.2.x-dev|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support 5.3.x-dev|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support 5.4.x-dev|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.1.1|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.1.13|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.1.16|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.1.2|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.1.20|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.1.22|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.1.25|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.1.28|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.1.30|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.1.31|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.1.41|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.1.6|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.1.8|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.2.0|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.2.19|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.2.21|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.2.24|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.2.25|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.2.26|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.2.27|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.2.28|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.2.31|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.2.32|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.2.37|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.2.43|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.2.45|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.2.6|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.2.7|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.3.0|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.3.16|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.3.23|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.3.4|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.4.0|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.4.13|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.4.17|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.4.19|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.4.27|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.4.9|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support 5.0.x-dev|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.0.0|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.0.22|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.0.25|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.0.26|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.0.28|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.0.33|don't install laravel/framework 5.5.x-dev
- don't install illuminate/support v5.0.4|don't install laravel/framework 5.5.x-dev
- Installation request for laravel/framework 5.5.* -> satisfiable by laravel/framework[5.5.x-dev].
Installation failed, reverting ./composer.json to its original content.
Hi.
I have included recaptcha and trying submit form with ajax, but recaptcha ignore them and submit form with URL. Do you know how fix this?
Hi
I'm running Laravel v5.2 and when I execute composer update
I have this stacktrace :
[2017-07-02 15:41:56] local.ERROR: exception 'ReflectionException' with message 'Class blade.compiler does not exist' in /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php:734
Stack trace:
#0 /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php(734): ReflectionClass->__construct('blade.compiler')
#1 /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php(629): Illuminate\Container\Container->build('blade.compiler', Array)
#2 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(697): Illuminate\Container\Container->make('blade.compiler', Array)
#3 /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php(573): Illuminate\Foundation\Application->make('Illuminate\\View...')
#4 /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php(533): Illuminate\Container\Container->addDependencyForCallParameter(Object(ReflectionParameter), Array, Array)
#5 /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php(505): Illuminate\Container\Container->getMethodDependencies(Array, Array)
#6 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(757): Illuminate\Container\Container->call(Array)
#7 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(740): Illuminate\Foundation\Application->bootProvider(Object(AlbertCht\InvisibleReCaptcha\InvisibleReCaptchaServiceProvider))
#8 [internal function]: Illuminate\Foundation\Application->Illuminate\Foundation\{closure}(Object(AlbertCht\InvisibleReCaptcha\InvisibleReCaptchaServiceProvider), 16)
#9 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(741): array_walk(Array, Object(Closure))
#10 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php(17): Illuminate\Foundation\Application->boot()
#11 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(203): Illuminate\Foundation\Bootstrap\BootProviders->bootstrap(Object(Illuminate\Foundation\Application))
#12 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(219): Illuminate\Foundation\Application->bootstrapWith(Array)
#13 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(105): Illuminate\Foundation\Console\Kernel->bootstrap()
#14 /var/www/artisan(36): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 {main}
If I remove the InvisibleReCaptchaServiceProvider
from my providers, I can update successfuly.
<input type="text" value="{{ old('email') }}" name="email" placeholder="Email *" class="form-control input-md form-group" required>
@captcha($lang = null)
submit form directly without taking the required fields in consideration
Hi there,
I use this in conjunction with jQuery Validate, provided by proengsoft/laravel-jsvalidation .
It seems that whenever I add @captcha() to my forms, these forms now submit even when invalid.
As soon as I remove the @captcha() line from the form, then the form behaves as expected, and will not submit if jQuery.validate({}) fails validation.
Any help would be appreciated. How do I prevent invisible-recaptcha to override .validate() and submit my form when it's invalid?
Is it possible somehow to process other Laravel validation rules first? For example if I have an email field, and it's required, recaptcha shouldn't "fire" only if a valid email entered..
Hello,
I have multiple forms in the same page that uses invisible reCaptcha the issue with this library
is that when rendering the captcha using
{!! app('captcha')->render(); !!}
It creates a _g-recaptcha
id
<div id="_g-recaptcha"></div>
ย
and also loads https://www.google.com/recaptcha/api.js script
if you could simple change _g-recaptcha
to use a class and load the script once with some other way like app('captcha')->init()
. Multi form support should work perfectly.
For the time being i will try to do it manually in the frontend without using app('captcha')->render()
method, but i hope that you will support this in the future.
Hi.
I'm getting this error:
Illuminate\Validation\ValidationException: The given data was invalid.
How can I send the captcha validation to my controller?
How to use with jquery validation (https://jqueryvalidation.org/)?
I'm using with this package for laravel https://github.com/proengsoft/laravel-jsvalidation
I try this, however the form or captcha is triggered before even validating all the fields.
_submitEvent = function() {
$('form').valid();
_submitForm();
}
I would like the captcha (and the correct one would be) to be triggered only when all the form inputs are valid. The package is fantastic, but I'd like to use it with Jquery Validation.
Any ideas to help me?
missing an equation sign from the following line (in CodeIgniter 3.x section):
$config['recaptcha.options'] [
corrected:
$config['recaptcha.options'] = [
Greetings,
I am using your package in my laravel project it is working great. But I do have one question is there a way to hide the site key from inspection. Cause when I inspect my registration page using google chrome I can see my sitekey there, and well do you really want it to be known to the whole world? So that is why I am asking if there is a way to encode or hide it from view?..
thanks
dcaldessa.
Uncaught TypeError: $(...).tooltip is not a function
at HTMLDocument. (skyweb.frame.js:32)
at j (jquery.min.js:2)
at Object.fireWith [as resolveWith] (jquery.min.js:2)
at Function.ready (jquery.min.js:2)
at HTMLDocument.J (jquery.min.js:2)
When the multiform invisible recaptcha is used, I get this error :/
When including the "@captcha" console displays a warning with the following:
app.js:sourcemap:44258 [Vue warn]: Error compiling template:
Any ideas on how to fix this? When "@captcha" is removed the error disappears.
Currently on my site the invisible recaptcha is not working on my registration page, and upon submit, the recaptca is failing and I have INVISIBLE_RECAPTCHA_DEBUG=true but don't see any logs inside of laravel.log or console errors. Where does this debug show up?
Validation
Add 'g-recaptcha-response' => 'required|captcha' to rules array.
$validate = Validator::make(Input::all(), [
'g-recaptcha-response' => 'required|captcha'
]);
Where do I add this on my laravel project ?
Thank you
<div id="_g-recaptcha"></div>
<div class="g-recaptcha" data-sitekey="x" data-bind="send-btn" data-callback="_submitForm"></div><script src="https://www.google.com/recaptcha/api.js" async defer></script>
<script>var _submitForm,_captchaForm,_captchaSubmit;</script>
<script>
window.onload=function(){_captchaForm=document.querySelector("#_g-recaptcha").closest("form");
_captchaSubmit=_captchaForm.querySelector('[type=submit]');
_submitForm=function(){if(typeof _submitEvent==="function"){_submitEvent();grecaptcha.reset();}else{_captchaForm.submit();
}}}
</script>
this is the HTML generated by {!! app('captcha')->render() !!}
the g-recaptcha-response in $_REQUEST comes back empty as well.
I am using the setting INVISIBLE_RECAPTCHA_DATABADGE='bottomright'
but this will position it to the bottom right of my form is there any way to position it to the bottom right of the entire window and not to its parent div?. Even better make it fixed position to the bottom right of the entire window and not to its parent
It also has this weird slide in animation if I hover on the badge, any way to disable that?
When adding
@captcha()
to multiple forms on a single page, the console shows an error:
Error: ReCAPTCHA placeholder element must be empty
Hi All,
Nice package. But default reCAPTCHA badge position is ignoring any page structure and goes under my bootstrap sticky footer and not visible :/
So we need to be able to pass data-badge
with inline value and have some styling options.
BR
please consider making changes in InvisibleReCaptchaServiceProvider.php
in register()
method
- $this->app->resolving('view', function () {
+ $this->app->resolving('blade.compiler', function () {
@albertcht
the conflict happens with spatie/laravel-permission
For more informations
Blade extensions are not registered and output as text in boot #458
LaravelCollective/html#330
Is it possible to override the Catcha div id on instantiation?
This would allow for multiple recaptchas on the same page.
issue is related to frameworks that doesnt allow script tags inside its container ex.vue so we have to move the captcha outside of it which means it will be outside of any form boundaries.
maybe a solution would be assigning an id to the form, and send it as a param to the captcha directive ex.
<form id='demo-form' action="?" method="POST">
<button>Submit</button>
</form>
@captcha('#demo-form')
I get error when submit button like "The g-recaptcha-response field is required"
I'm running into an issue where the Captcha does not load in IE so on form submission it always returns "The g-recaptcha-response field is required". This problem is exclusive to IE and when viewing the console in IE there is an error message. SCRIPT5: Access is denied.
where is exactly is the rules array located? I am I suppose to create a form request validation and deposit that code in the rules function?
Hey,
When I install this package via composer I get the master branch, how to install the multi-forms with composer?
hello,
in your tutorial blade @captcha()
render syntax error function like this <?php echo app('captcha')->render(()); ?>
. If i write @captcha
all good
Hello, thank you for your cool package.
I have issue with multiple re captchas on single page. I have 3 forms, login, registration and reset password.
2 of them hidde, when you click button, appears form we need. I do not want to do this with ajax or async loading forms. Because user can loop it and do bad stuff to server, loading forms. So i think this is bad practice to do like that.
When i use @captcha($lang = null)
on all my 3 forms, it show 2 error for other 2 form. So only 1 re-captcha works, other to not.
ERROR
Uncaught Error: ReCAPTCHA placeholder element must be empty at nr (recaptcha__ru.js:473) at recaptcha__ru.js:478 at c (recaptcha__ru.js:468)
How to fix it? Or i should try visible captcha? Will it work?
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.