Skip to content

Conversation

@simivar
Copy link
Contributor

@simivar simivar commented Mar 2, 2016

New Google reCaptcha 2 validator.

Google reCaptcha API CAN NOT be included by hand. Script handles that for user. reCaptcha validator works on hidden input even when validateHiddenInputs is set to false.

Example of usage:

<input type="hidden" data-validation="recaptcha" />
...
<script>
$.validate({
     modules: 'security',
     reCaptchaSiteKey: 'yourSiteKey', // required
     reCaptchaTheme: 'light' // light|dark, default: light
});
</script>

Or:

<input type="hidden" 
   data-validation="recaptcha" 
   data-validation-recaptcha-sitekey="yourSiteKey" 
   data-validation-recaptcha-theme="light" />

simivar added 3 commits March 2, 2016 11:12
replace double quotes with single quotes and deleted unused variable
from validator function
changed name of data options to indicate that they are in fact for
recaptcha
@simivar simivar changed the title Added Google reCaptcha 2 validator Add Google reCaptcha 2 validator Mar 2, 2016
@victorjonsson
Copy link
Owner

This is a truly great feature!

name: 'recaptcha',
validatorFunction: function (val, $el)
{
return grecaptcha.getResponse($el.data('validation-recaptcha-widget-id'));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use $.fn.valAttr instead of $.fn.data

victorjonsson added a commit that referenced this pull request Mar 4, 2016
Add Google reCaptcha 2 validator
@victorjonsson victorjonsson merged commit a87b9ce into victorjonsson:master Mar 4, 2016
@victorjonsson
Copy link
Owner

Great contribution! The plugin was lacking a solid captcha solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants