reCAPTCHA v3 support and general tidy up

This commit is contained in:
Tom Slominski
2019-01-09 14:38:43 +00:00
parent 5546bacae8
commit 895280fed7
7 changed files with 162 additions and 83 deletions

View File

@@ -48,3 +48,14 @@ if( document.querySelectorAll( '.copy-button' ).length > 0 ) {
} );
}
// reCAPTCHA
if( 'object' === typeof grecaptcha ) {
grecaptcha.ready( function() {
var sitekey = document.querySelectorAll( '#recaptcha-sitekey' )[0].innerHTML;
grecaptcha.execute( sitekey, {action: 'homepage'} ).then( function( token ) {
document.querySelectorAll( '#recaptcha_token' )[0].value = token;
});
});
}