init
This commit is contained in:
42
user/plugins/form/vendor/google/recaptcha/examples/appengine-https.php
vendored
Normal file
42
user/plugins/form/vendor/google/recaptcha/examples/appengine-https.php
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* BSD 3-Clause License
|
||||
* @copyright (c) 2019, Google Inc.
|
||||
* @link https://www.google.com/recaptcha
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// Redirect to HTTPS by default (for AppEngine)
|
||||
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) {
|
||||
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] === 'http') {
|
||||
header('HTTP/1.1 301 Moved Permanently');
|
||||
header('Location: https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']);
|
||||
exit(0);
|
||||
} else {
|
||||
header('Strict-Transport-Security: max-age=63072000; includeSubDomains; preload');
|
||||
}
|
||||
}
|
||||
46
user/plugins/form/vendor/google/recaptcha/examples/config.php.dist
vendored
Normal file
46
user/plugins/form/vendor/google/recaptcha/examples/config.php.dist
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* BSD 3-Clause License
|
||||
* @copyright (c) 2019, Google Inc.
|
||||
* @link https://www.google.com/recaptcha
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
return [
|
||||
'v2-standard' => [
|
||||
'site' => '',
|
||||
'secret' => '',
|
||||
],
|
||||
'v2-invisible' => [
|
||||
'site' => '',
|
||||
'secret' => '',
|
||||
],
|
||||
'v3' => [
|
||||
'site' => '',
|
||||
'secret' => '',
|
||||
],
|
||||
];
|
||||
37
user/plugins/form/vendor/google/recaptcha/examples/examples.css
vendored
Normal file
37
user/plugins/form/vendor/google/recaptcha/examples/examples.css
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
p {
|
||||
margin: 0;
|
||||
padding: 0.5rem 0 0 0;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2 {
|
||||
color: #222244;
|
||||
}
|
||||
|
||||
header {
|
||||
padding: 0.5rem 2rem 0.5rem 2rem;
|
||||
background: #f0f0f4;
|
||||
border-bottom: 1px solid #aaaabb;
|
||||
}
|
||||
|
||||
main {
|
||||
padding: 0.5rem 2rem 0.5rem 2rem;
|
||||
}
|
||||
|
||||
.form-field {
|
||||
display: block;
|
||||
margin: 1rem;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
1
user/plugins/form/vendor/google/recaptcha/examples/google0afd8760fd68f119.html
vendored
Normal file
1
user/plugins/form/vendor/google/recaptcha/examples/google0afd8760fd68f119.html
vendored
Normal file
@@ -0,0 +1 @@
|
||||
google-site-verification: google0afd8760fd68f119.html
|
||||
79
user/plugins/form/vendor/google/recaptcha/examples/index.php
vendored
Normal file
79
user/plugins/form/vendor/google/recaptcha/examples/index.php
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/**
|
||||
* BSD 3-Clause License
|
||||
* @copyright (c) 2019, Google Inc.
|
||||
* @link https://www.google.com/recaptcha
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
require __DIR__ . '/appengine-https.php';
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width,height=device-height,minimum-scale=1">
|
||||
<link rel="shortcut icon" href="https://www.gstatic.com/recaptcha/admin/favicon.ico" type="image/x-icon"/>
|
||||
<link rel="canonical" href="https://recaptcha-demo.appspot.com/">
|
||||
<script type="application/ld+json">{ "@context": "http://schema.org", "@type": "WebSite", "name": "reCAPTCHA demo", "url": "http://recaptcha-demo.appspot.com/" }</script>
|
||||
<meta name="description" content="reCAPTCHA demo" />
|
||||
<meta property="og:url" content="https://recaptcha-demo.appspot.com/" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="reCAPTCHA demo" />
|
||||
<meta property="og:description" content="Examples of the reCAPTCHA client." />
|
||||
<link rel="stylesheet" type="text/css" href="/examples.css">
|
||||
<title>reCAPTCHA demo</title>
|
||||
|
||||
<header>
|
||||
<h1>reCAPTCHA demo</h1>
|
||||
</header>
|
||||
<main>
|
||||
<p>Try out the various forms of <a href="https://www.google.com/recaptcha/">reCAPTCHA</a>.</p>
|
||||
<p>You can find the source code for these examples on GitHub in <kbd><a href="https://github.com/google/recaptcha">google/recaptcha</a></kbd>.</p>
|
||||
<ul>
|
||||
<li><h2>reCAPTCHA v2</h2>
|
||||
<ul>
|
||||
<li><a href="/recaptcha-v2-checkbox.php">"I'm not a robot" checkbox</a></li>
|
||||
<li><a href="/recaptcha-v2-checkbox-explicit.php">"I'm not a robot" checkbox - Explicit render</a></li>
|
||||
<li><a href="/recaptcha-v2-invisible.php">Invisible</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><h2>reCAPTCHA v3</h2>
|
||||
<ul>
|
||||
<li><a href="/recaptcha-v3-request-scores.php">Request scores</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><h2>General</h2>
|
||||
<ul>
|
||||
<li><a href="/recaptcha-content-security-policy.php">Content Security Policy</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</main>
|
||||
|
||||
<!-- Google Analytics - just ignore this -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-123057962-1"></script>
|
||||
<script>window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-123057962-1');</script>
|
||||
152
user/plugins/form/vendor/google/recaptcha/examples/recaptcha-content-security-policy.php
vendored
Normal file
152
user/plugins/form/vendor/google/recaptcha/examples/recaptcha-content-security-policy.php
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
<?php
|
||||
/**
|
||||
* BSD 3-Clause License
|
||||
* @copyright (c) 2019, Google Inc.
|
||||
* @link https://www.google.com/recaptcha
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
require __DIR__ . '/appengine-https.php';
|
||||
|
||||
// Initiate the autoloader. The file should be generated by Composer.
|
||||
// You will provide your own autoloader or require the files directly if you did
|
||||
// not install via Composer.
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
// This example shows the use of a Content Security Policy
|
||||
// https://developers.google.com/web/fundamentals/security/csp/
|
||||
|
||||
// First we generate a pseudorandom nonce for each included or inline script
|
||||
$nonce = base64_encode(openssl_random_pseudo_bytes(16));
|
||||
|
||||
// Send the CSP header
|
||||
// Try commenting out the various lines to see what effect it has
|
||||
|
||||
// NOTE: Always test your policy Content-Security-Policy-Report-Only first to
|
||||
// ensure you're not blocking any critical functionality. CSP is an important
|
||||
// security feature but you can break entire sections of your site if you
|
||||
// implement it incorrectly.
|
||||
header(
|
||||
"Content-Security-Policy: "
|
||||
."default-src 'none'; " // By default we will deny everything
|
||||
|
||||
."script-src 'nonce-".$nonce."' 'strict-dynamic'; " // nonce allowing the reCAPTCHA library and other third-party scripts to be included
|
||||
|
||||
."img-src https://www.gstatic.com/recaptcha/ https://www.google-analytics.com; " // allow images from these URLS
|
||||
."frame-src https://www.google.com/; " // allow frames from this URL
|
||||
|
||||
."style-src 'self'; " // allow style from our own origin
|
||||
."connect-src 'self'; " // allow the fetch calls to our own origin
|
||||
);
|
||||
|
||||
// Register API keys at https://www.google.com/recaptcha/admin
|
||||
$siteKey = '';
|
||||
$secret = '';
|
||||
|
||||
// Copy the config.php.dist file to config.php and update it with your keys to run the examples
|
||||
if ($siteKey == '' && is_readable(__DIR__ . '/config.php')) {
|
||||
$config = include __DIR__ . '/config.php';
|
||||
$siteKey = $config['v3']['site'];
|
||||
$secret = $config['v3']['secret'];
|
||||
}
|
||||
|
||||
// reCAPTCHA supports 40+ languages listed here: https://developers.google.com/recaptcha/docs/language
|
||||
$lang = 'en';
|
||||
|
||||
// The v3 API lets you provide some context for the check by specifying an action.
|
||||
// See: https://developers.google.com/recaptcha/docs/v3
|
||||
$pageAction = 'examples/csp';
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width,height=device-height,minimum-scale=1">
|
||||
<link rel="shortcut icon" href="https://www.gstatic.com/recaptcha/admin/favicon.ico" type="image/x-icon"/>
|
||||
<link rel="canonical" href="https://recaptcha-demo.appspot.com/recaptcha-content-security-policy.php">
|
||||
<script type="application/ld+json">{ "@context": "http://schema.org", "@type": "WebSite", "name": "reCAPTCHA demo - Content Security Policy", "url": "https://recaptcha-demo.appspot.com/recaptcha-content-security-policy.php" }</script>
|
||||
<meta name="description" content="reCAPTCHA demo - Content Security Policy" />
|
||||
<meta property="og:url" content="https://recaptcha-demo.appspot.com/recaptcha-content-security-policy.php" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="reCAPTCHA demo - Content Security Policy" />
|
||||
<meta property="og:description" content="reCAPTCHA demo - Content Security Policy" />
|
||||
<link rel="stylesheet" type="text/css" href="/examples.css">
|
||||
<title>reCAPTCHA demo - Content Security Policy</title>
|
||||
<header>
|
||||
<h1>reCAPTCHA demo</h1><h2>Content Security Policy</h2>
|
||||
<p><a href="/">↩️ Home</a></p>
|
||||
</header>
|
||||
<main>
|
||||
<?php
|
||||
if ($siteKey === '' || $secret === ''):
|
||||
?>
|
||||
<h2>Add your keys</h2>
|
||||
<p>If you do not have keys already then visit <kbd> <a href = "https://www.google.com/recaptcha/admin">https://www.google.com/recaptcha/admin</a></kbd> to generate them. Edit this file and set the respective keys in <kbd>$siteKey</kbd> and <kbd>$secret</kbd>. Reload the page after this.</p>
|
||||
<?php
|
||||
else:
|
||||
?>
|
||||
<p>This example is sending the <kbd>Content-Security-Policy</kbd> header. Look at the source and inspect the network tab for this request to see what's happening. The reCAPTCHA v3 API is being called here, however you can use the same approach for the v2 API calls as well.</p>
|
||||
<p><strong>NOTE:</strong>This is a sample implementation, the score returned here is not a reflection on your Google account or type of traffic. In production, refer to the distribution of scores shown in <a href="https://www.google.com/recaptcha/admin" target="_blank">your admin interface</a> and adjust your own threshold accordingly. <strong>Do not raise issues regarding the score you see here.</strong></p>
|
||||
<ol id="recaptcha-steps">
|
||||
<li class="step0">reCAPTCHA script loading</li>
|
||||
<li class="step1 hidden"><kbd>grecaptcha.ready()</kbd> fired, calling <pre>grecaptcha.execute('<?php echo $siteKey; ?>', {action: '<?php echo $pageAction; ?>'})'</pre></li>
|
||||
<li class="step2 hidden">Received token from reCAPTCHA service, sending to our backend with:
|
||||
<pre class="token">fetch('/recaptcha-v3-verify.php?token=abc123</pre></li>
|
||||
<li class="step3 hidden">Received response from our backend: <pre class="response">{"json": "from-backend"}</pre></li>
|
||||
</ol>
|
||||
<p><a href="/recaptcha-content-security-policy.php">⤴️ Try again</a></p>
|
||||
|
||||
<!-- Add the nonce for our inline script to this tag -->
|
||||
<script nonce="<?php echo $nonce; ?>">
|
||||
var onloadCallback = function() {
|
||||
const steps = document.getElementById('recaptcha-steps');
|
||||
grecaptcha.ready(function() {
|
||||
document.querySelector('.step1').classList.remove('hidden');
|
||||
grecaptcha.execute('<?php echo $siteKey; ?>', {action: '<?php echo $pageAction; ?>'}).then(function(token) {
|
||||
document.querySelector('.token').innerHTML = 'fetch(\'/recaptcha-v3-verify.php?action=<?php echo $pageAction; ?>&token=\'' + token;
|
||||
document.querySelector('.step2').classList.remove('hidden');
|
||||
|
||||
fetch('/recaptcha-v3-verify.php?action=<?php echo $pageAction; ?>&token='+token).then(function(response) {
|
||||
response.json().then(function(data) {
|
||||
document.querySelector('.response').innerHTML = JSON.stringify(data, null, 2);
|
||||
document.querySelector('.step3').classList.remove('hidden');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
</script>
|
||||
<!-- Add the nonce value for the reCAPTCHA library to its script tag -->
|
||||
<script async defer src="https://www.google.com/recaptcha/api.js?render=<?php echo $siteKey; ?>&onload=onloadCallback" nonce="<?php echo $nonce; ?>"></script>
|
||||
|
||||
<?php
|
||||
endif;?>
|
||||
</main>
|
||||
|
||||
<!-- Google Analytics - adding nonces here for the library and the inline code -->
|
||||
<script async defer src="https://www.googletagmanager.com/gtag/js?id=UA-123057962-1" nonce="<?php echo $nonce; ?>"></script>
|
||||
<script async nonce="<?php echo $nonce; ?>">window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-123057962-1');</script>
|
||||
148
user/plugins/form/vendor/google/recaptcha/examples/recaptcha-v2-checkbox-explicit.php
vendored
Normal file
148
user/plugins/form/vendor/google/recaptcha/examples/recaptcha-v2-checkbox-explicit.php
vendored
Normal file
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
/**
|
||||
* BSD 3-Clause License
|
||||
* @copyright (c) 2019, Google Inc.
|
||||
* @link https://www.google.com/recaptcha
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
require __DIR__ . '/appengine-https.php';
|
||||
|
||||
// Initiate the autoloader. The file should be generated by Composer.
|
||||
// You will provide your own autoloader or require the files directly if you did
|
||||
// not install via Composer.
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
// Register API keys at https://www.google.com/recaptcha/admin
|
||||
$siteKey = '';
|
||||
$secret = '';
|
||||
|
||||
// Copy the config.php.dist file to config.php and update it with your keys to run the examples
|
||||
if ($siteKey == '' && is_readable(__DIR__ . '/config.php')) {
|
||||
$config = include __DIR__ . '/config.php';
|
||||
$siteKey = $config['v2-standard']['site'];
|
||||
$secret = $config['v2-standard']['secret'];
|
||||
}
|
||||
|
||||
// reCAPTCHA supports 40+ languages listed here: https://developers.google.com/recaptcha/docs/language
|
||||
$lang = 'en';
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width,height=device-height,minimum-scale=1">
|
||||
<link rel="shortcut icon" href="https://www.gstatic.com/recaptcha/admin/favicon.ico" type="image/x-icon"/>
|
||||
<link rel="canonical" href="https://recaptcha-demo.appspot.com/recaptcha-v2-checkbox-explicit.php">
|
||||
<script type="application/ld+json">{ "@context": "http://schema.org", "@type": "WebSite", "name": "reCAPTCHA demo - \"I'm not a robot\" checkbox - Explicit render", "url": "https://recaptcha-demo.appspot.com/recaptcha-v2-checkbox-explicit.php" }</script>
|
||||
<meta name="description" content="reCAPTCHA demo - "I'm not a robot" checkbox - Explicit render" />
|
||||
<meta property="og:url" content="https://recaptcha-demo.appspot.com/recaptcha-v2-checkbox-explicit.php" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="reCAPTCHA demo - "I'm not a robot" checkbox - Explicit render" />
|
||||
<meta property="og:description" content="reCAPTCHA demo - "I'm not a robot" checkbox - Explicit render" />
|
||||
<link rel="stylesheet" type="text/css" href="/examples.css">
|
||||
<title>reCAPTCHA demo - "I'm not a robot" checkbox - Explicit render</title>
|
||||
|
||||
<header>
|
||||
<h1>reCAPTCHA demo</h1><h2>"I'm not a robot" checkbox - Explicit render</h2>
|
||||
<p><a href="/">↩️ Home</a></p>
|
||||
</header>
|
||||
<main>
|
||||
<?php
|
||||
if ($siteKey === '' || $secret === ''):
|
||||
?>
|
||||
<h2>Add your keys</h2>
|
||||
<p>If you do not have keys already then visit <kbd> <a href = "https://www.google.com/recaptcha/admin">https://www.google.com/recaptcha/admin</a></kbd> to generate them. Edit this file and set the respective keys in the <kbd>config.php</kbd> file or directly to <kbd>$siteKey</kbd> and <kbd>$secret</kbd>. Reload the page after this.</p>
|
||||
<?php
|
||||
elseif (isset($_POST['g-recaptcha-response'])):
|
||||
// The POST data here is unfiltered because this is an example.
|
||||
// In production, *always* sanitise and validate your input'
|
||||
?>
|
||||
<h2><kbd>POST</kbd> data</h2>
|
||||
<kbd><pre><?php var_export($_POST);?></pre></kbd>
|
||||
<?php
|
||||
// If the form submission includes the "g-captcha-response" field
|
||||
// Create an instance of the service using your secret
|
||||
$recaptcha = new \ReCaptcha\ReCaptcha($secret);
|
||||
|
||||
// If file_get_contents() is locked down on your PHP installation to disallow
|
||||
// its use with URLs, then you can use the alternative request method instead.
|
||||
// This makes use of fsockopen() instead.
|
||||
// $recaptcha = new \ReCaptcha\ReCaptcha($secret, new \ReCaptcha\RequestMethod\SocketPost());
|
||||
// Make the call to verify the response and also pass the user's IP address
|
||||
$resp = $recaptcha->setExpectedHostname($_SERVER['SERVER_NAME'])
|
||||
->verify($_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']);
|
||||
|
||||
if ($resp->isSuccess()):
|
||||
// If the response is a success, that's it!
|
||||
?>
|
||||
<h2>Success!</h2>
|
||||
<kbd><pre><?php var_export($resp);?></pre></kbd>
|
||||
<p>That's it. Everything is working. Go integrate this into your real project.</p>
|
||||
<p><a href="/recaptcha-v2-checkbox-explicit.php">⤴️ Try again</a></p>
|
||||
<?php
|
||||
else:
|
||||
// If it's not successful, then one or more error codes will be returned.
|
||||
?>
|
||||
<h2>Something went wrong</h2>
|
||||
<kbd><pre><?php var_export($resp);?></pre></kbd>
|
||||
<p>Check the error code reference at <kbd><a href="https://developers.google.com/recaptcha/docs/verify#error-code-reference">https://developers.google.com/recaptcha/docs/verify#error-code-reference</a></kbd>.
|
||||
<p><strong>Note:</strong> Error code <kbd>missing-input-response</kbd> may mean the user just didn't complete the reCAPTCHA.</p>
|
||||
<p><a href="/recaptcha-v2-checkbox-explicit.php">⤴️ Try again</a></p>
|
||||
<?php
|
||||
endif;
|
||||
else:
|
||||
// Add the g-recaptcha tag to the form you want to include the reCAPTCHA element
|
||||
?>
|
||||
<p>Complete the reCAPTCHA then submit the form.</p>
|
||||
<form action="/recaptcha-v2-checkbox-explicit.php" method="post">
|
||||
<fieldset>
|
||||
<legend>An example form</legend>
|
||||
<label class="form-field">Example input A: <input type="text" name="ex-a" value="foo"></label>
|
||||
<label class="form-field">Example input B: <input type="text" name="ex-b" value="bar"></label>
|
||||
<!-- Set up a container to render the widget -->
|
||||
<div class="g-recaptcha form-field"></div>
|
||||
<!-- Disable the button by default, will enable when the widget loads -->
|
||||
<button class="form-field" type="submit" disabled>Submit ↦</button>
|
||||
</fieldset>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
var onloadCallback = function() {
|
||||
var captchaContainer = document.querySelector('.g-recaptcha');
|
||||
grecaptcha.render(captchaContainer, {
|
||||
'sitekey' : '<?php echo $siteKey; ?>'
|
||||
});
|
||||
document.querySelector('button[type="submit"]').disabled = false;
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" src="https://www.google.com/recaptcha/api.js?hl=<?php echo $lang; ?>&onload=onloadCallback&render=explicit" async defer></script>
|
||||
<?php
|
||||
endif;?>
|
||||
</main>
|
||||
|
||||
<!-- Google Analytics - just ignore this -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-123057962-1"></script>
|
||||
<script>window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-123057962-1');</script>
|
||||
139
user/plugins/form/vendor/google/recaptcha/examples/recaptcha-v2-checkbox.php
vendored
Normal file
139
user/plugins/form/vendor/google/recaptcha/examples/recaptcha-v2-checkbox.php
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
<?php
|
||||
/**
|
||||
* BSD 3-Clause License
|
||||
* @copyright (c) 2019, Google Inc.
|
||||
* @link https://www.google.com/recaptcha
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
require __DIR__ . '/appengine-https.php';
|
||||
|
||||
// Initiate the autoloader. The file should be generated by Composer.
|
||||
// You will provide your own autoloader or require the files directly if you did
|
||||
// not install via Composer.
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
// Register API keys at https://www.google.com/recaptcha/admin
|
||||
$siteKey = '';
|
||||
$secret = '';
|
||||
|
||||
// Copy the config.php.dist file to config.php and update it with your keys to run the examples
|
||||
if ($siteKey == '' && is_readable(__DIR__ . '/config.php')) {
|
||||
$config = include __DIR__ . '/config.php';
|
||||
$siteKey = $config['v2-standard']['site'];
|
||||
$secret = $config['v2-standard']['secret'];
|
||||
}
|
||||
|
||||
// reCAPTCHA supports 40+ languages listed here: https://developers.google.com/recaptcha/docs/language
|
||||
$lang = 'en';
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width,height=device-height,minimum-scale=1">
|
||||
<link rel="shortcut icon" href="https://www.gstatic.com/recaptcha/admin/favicon.ico" type="image/x-icon"/>
|
||||
<link rel="canonical" href="https://recaptcha-demo.appspot.com/recaptcha-v2-checkbox.php">
|
||||
<script type="application/ld+json">{ "@context": "http://schema.org", "@type": "WebSite", "name": "reCAPTCHA demo - \"I'm not a robot\" checkbox", "url": "https://recaptcha-demo.appspot.com/recaptcha-v2-checkbox.php" }</script>
|
||||
<meta name="description" content="reCAPTCHA demo - "I'm not a robot" checkbox" />
|
||||
<meta property="og:url" content="https://recaptcha-demo.appspot.com/recaptcha-v2-checkbox.php" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="reCAPTCHA demo - "I'm not a robot" checkbox" />
|
||||
<meta property="og:description" content="reCAPTCHA demo - "I'm not a robot" checkbox" />
|
||||
<link rel="stylesheet" type="text/css" href="/examples.css">
|
||||
<title>reCAPTCHA demo - "I'm not a robot" checkbox</title>
|
||||
|
||||
<header>
|
||||
<h1>reCAPTCHA demo</h1><h2>"I'm not a robot" checkbox</h2>
|
||||
<p><a href="/">↩️ Home</a></p>
|
||||
</header>
|
||||
<main>
|
||||
<?php
|
||||
if ($siteKey === '' || $secret === ''):
|
||||
?>
|
||||
<h2>Add your keys</h2>
|
||||
<p>If you do not have keys already then visit <kbd> <a href = "https://www.google.com/recaptcha/admin">https://www.google.com/recaptcha/admin</a></kbd> to generate them. Edit this file and set the respective keys in the <kbd>config.php</kbd> file or directly to <kbd>$siteKey</kbd> and <kbd>$secret</kbd>. Reload the page after this.</p>
|
||||
<?php
|
||||
elseif (isset($_POST['g-recaptcha-response'])):
|
||||
// The POST data here is unfiltered because this is an example.
|
||||
// In production, *always* sanitise and validate your input'
|
||||
?>
|
||||
<h2><kbd>POST</kbd> data</h2>
|
||||
<kbd><pre><?php var_export($_POST);?></pre></kbd>
|
||||
<?php
|
||||
// If the form submission includes the "g-captcha-response" field
|
||||
// Create an instance of the service using your secret
|
||||
$recaptcha = new \ReCaptcha\ReCaptcha($secret);
|
||||
|
||||
// If file_get_contents() is locked down on your PHP installation to disallow
|
||||
// its use with URLs, then you can use the alternative request method instead.
|
||||
// This makes use of fsockopen() instead.
|
||||
// $recaptcha = new \ReCaptcha\ReCaptcha($secret, new \ReCaptcha\RequestMethod\SocketPost());
|
||||
|
||||
// Make the call to verify the response and also pass the user's IP address
|
||||
$resp = $recaptcha->setExpectedHostname($_SERVER['SERVER_NAME'])
|
||||
->verify($_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']);
|
||||
if ($resp->isSuccess()):
|
||||
// If the response is a success, that's it!
|
||||
?>
|
||||
<h2>Success!</h2>
|
||||
<kbd><pre><?php var_export($resp);?></pre></kbd>
|
||||
<p>That's it. Everything is working. Go integrate this into your real project.</p>
|
||||
<p><a href="/recaptcha-v2-checkbox.php">⤴️ Try again</a></p>
|
||||
<?php
|
||||
else:
|
||||
// If it's not successful, then one or more error codes will be returned.
|
||||
?>
|
||||
<h2>Something went wrong</h2>
|
||||
<kbd><pre><?php var_export($resp);?></pre></kbd>
|
||||
<p>Check the error code reference at <kbd><a href="https://developers.google.com/recaptcha/docs/verify#error-code-reference">https://developers.google.com/recaptcha/docs/verify#error-code-reference</a></kbd>.
|
||||
<p><strong>Note:</strong> Error code <kbd>missing-input-response</kbd> may mean the user just didn't complete the reCAPTCHA.</p>
|
||||
<p><a href="/recaptcha-v2-checkbox.php">⤴️ Try again</a></p>
|
||||
<?php
|
||||
endif;
|
||||
else:
|
||||
// Add the g-recaptcha tag to the form you want to include the reCAPTCHA element
|
||||
?>
|
||||
<p>Complete the reCAPTCHA then submit the form.</p>
|
||||
<form action="/recaptcha-v2-checkbox.php" method="post">
|
||||
<fieldset>
|
||||
<legend>An example form</legend>
|
||||
<label class="form-field">Example input A: <input type="text" name="ex-a" value="foo"></label>
|
||||
<label class="form-field">Example input B: <input type="text" name="ex-b" value="bar"></label>
|
||||
<!-- Default behaviour looks for the g-recaptcha class with a data-sitekey attribute -->
|
||||
<div class="g-recaptcha form-field" data-sitekey="<?php echo $siteKey; ?>"></div>
|
||||
<!-- Submitting before the widget loads will result in a missing-input-response error so you need to verify server side -->
|
||||
<button class="form-field" type="submit">Submit ↦</button>
|
||||
</fieldset>
|
||||
</form>
|
||||
<script type="text/javascript" src="https://www.google.com/recaptcha/api.js?hl=<?php echo $lang; ?>"></script>
|
||||
<?php
|
||||
endif;?>
|
||||
</main>
|
||||
|
||||
<!-- Google Analytics - just ignore this -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-123057962-1"></script>
|
||||
<script>window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-123057962-1');</script>
|
||||
141
user/plugins/form/vendor/google/recaptcha/examples/recaptcha-v2-invisible.php
vendored
Normal file
141
user/plugins/form/vendor/google/recaptcha/examples/recaptcha-v2-invisible.php
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
/**
|
||||
* BSD 3-Clause License
|
||||
* @copyright (c) 2019, Google Inc.
|
||||
* @link https://www.google.com/recaptcha
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
require __DIR__ . '/appengine-https.php';
|
||||
|
||||
// Initiate the autoloader. The file should be generated by Composer.
|
||||
// You will provide your own autoloader or require the files directly if you did
|
||||
// not install via Composer.
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
// Register API keys at https://www.google.com/recaptcha/admin
|
||||
$siteKey = '';
|
||||
$secret = '';
|
||||
|
||||
// Copy the config.php.dist file to config.php and update it with your keys to run the examples
|
||||
if ($siteKey == '' && is_readable(__DIR__ . '/config.php')) {
|
||||
$config = include __DIR__ . '/config.php';
|
||||
$siteKey = $config['v2-invisible']['site'];
|
||||
$secret = $config['v2-invisible']['secret'];
|
||||
}
|
||||
|
||||
// reCAPTCHA supports 40+ languages listed here: https://developers.google.com/recaptcha/docs/language
|
||||
$lang = 'en';
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width,height=device-height,minimum-scale=1">
|
||||
<link rel="shortcut icon" href="https://www.gstatic.com/recaptcha/admin/favicon.ico" type="image/x-icon"/>
|
||||
<link rel="canonical" href="https://recaptcha-demo.appspot.com/recaptcha-v2-invisible.php">
|
||||
<script type="application/ld+json">{ "@context": "http://schema.org", "@type": "WebSite", "name": "reCAPTCHA demo - Invisible", "url": "https://recaptcha-demo.appspot.com/recaptcha-v2-invisible.php" }</script>
|
||||
<meta name="description" content="reCAPTCHA demo - Invisible" />
|
||||
<meta property="og:url" content="https://recaptcha-demo.appspot.com/recaptcha-v2-invisible.php" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="reCAPTCHA demo - Invisible" />
|
||||
<meta property="og:description" content="reCAPTCHA demo - Invisible" />
|
||||
<link rel="stylesheet" type="text/css" href="/examples.css">
|
||||
<title>reCAPTCHA demo - Invisible</title>
|
||||
|
||||
<header>
|
||||
<h1>reCAPTCHA demo</h1><h2>Invisible</h2>
|
||||
<p><a href="/">↩️ Home</a></p>
|
||||
</header>
|
||||
<main>
|
||||
<?php
|
||||
if ($siteKey === '' || $secret === ''):
|
||||
?>
|
||||
<h2>Add your keys</h2>
|
||||
<p>If you do not have keys already then visit <kbd> <a href = "https://www.google.com/recaptcha/admin">https://www.google.com/recaptcha/admin</a></kbd> to generate them. Edit this file and set the respective keys in <kbd>$siteKey</kbd> and <kbd>$secret</kbd>. Reload the page after this.</p>
|
||||
<?php
|
||||
elseif (isset($_POST['g-recaptcha-response'])):
|
||||
// The POST data here is unfiltered because this is an example.
|
||||
// In production, *always* sanitise and validate your input'
|
||||
?>
|
||||
<h2><kbd>POST</kbd> data</h2>
|
||||
<kbd><pre><?php var_export($_POST);?></pre></kbd>
|
||||
<?php
|
||||
// If the form submission includes the "g-captcha-response" field
|
||||
// Create an instance of the service using your secret
|
||||
$recaptcha = new \ReCaptcha\ReCaptcha($secret);
|
||||
|
||||
// If file_get_contents() is locked down on your PHP installation to disallow
|
||||
// its use with URLs, then you can use the alternative request method instead.
|
||||
// This makes use of fsockopen() instead.
|
||||
// $recaptcha = new \ReCaptcha\ReCaptcha($secret, new \ReCaptcha\RequestMethod\SocketPost());
|
||||
|
||||
// Make the call to verify the response and also pass the user's IP address
|
||||
$resp = $recaptcha->setExpectedHostname($_SERVER['SERVER_NAME'])
|
||||
->verify($_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']);
|
||||
if ($resp->isSuccess()):
|
||||
// If the response is a success, that's it!
|
||||
?>
|
||||
<h2>Success!</h2>
|
||||
<kbd><pre><?php var_export($resp);?></pre></kbd>
|
||||
<p>That's it. Everything is working. Go integrate this into your real project.</p>
|
||||
<p><a href="/recaptcha-v2-invisible.php">⤴️ Try again</a></p>
|
||||
<?php
|
||||
else:
|
||||
// If it's not successful, then one or more error codes will be returned.
|
||||
?>
|
||||
<h2>Something went wrong</h2>
|
||||
<kbd><pre><?php var_export($resp);?></pre></kbd>
|
||||
<p>Check the error code reference at <kbd><a href="https://developers.google.com/recaptcha/docs/verify#error-code-reference">https://developers.google.com/recaptcha/docs/verify#error-code-reference</a></kbd>.
|
||||
<p><strong>Note:</strong> Error code <kbd>missing-input-response</kbd> may mean the user just didn't complete the reCAPTCHA.</p>
|
||||
<p><a href="/recaptcha-v2-invisible.php">⤴️ Try again</a></p>
|
||||
<?php
|
||||
endif;
|
||||
else:
|
||||
// Add the g-recaptcha tag to the form you want to include the reCAPTCHA element
|
||||
?>
|
||||
<p>Submit the form and reCAPTCHA will run automatically.</p>
|
||||
<form action="/recaptcha-v2-invisible.php" method="post" id="demo-form">
|
||||
<fieldset>
|
||||
<legend>An example form</legend>
|
||||
<label class="form-field">Example input A: <input type="text" name="ex-a" value="foo"></label>
|
||||
<label class="form-field">Example input B: <input type="text" name="ex-b" value="bar"></label>
|
||||
<button class="g-recaptcha form-field" data-sitekey="<?php echo $siteKey; ?>" data-callback='onSubmit'>Submit ↦</button>
|
||||
</fieldset>
|
||||
</form>
|
||||
<script type="text/javascript" src="https://www.google.com/recaptcha/api.js?hl=<?php echo $lang; ?>" async defer></script>
|
||||
<script type="text/javascript">
|
||||
function onSubmit(token) {
|
||||
document.getElementById("demo-form").submit();
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
endif;?>
|
||||
</main>
|
||||
|
||||
<!-- Google Analytics - just ignore this -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-123057962-1"></script>
|
||||
<script>window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-123057962-1');</script>
|
||||
120
user/plugins/form/vendor/google/recaptcha/examples/recaptcha-v3-request-scores.php
vendored
Normal file
120
user/plugins/form/vendor/google/recaptcha/examples/recaptcha-v3-request-scores.php
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
/**
|
||||
* BSD 3-Clause License
|
||||
* @copyright (c) 2019, Google Inc.
|
||||
* @link https://www.google.com/recaptcha
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
require __DIR__ . '/appengine-https.php';
|
||||
|
||||
// Initiate the autoloader. The file should be generated by Composer.
|
||||
// You will provide your own autoloader or require the files directly if you did
|
||||
// not install via Composer.
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
// Register API keys at https://www.google.com/recaptcha/admin
|
||||
$siteKey = '';
|
||||
$secret = '';
|
||||
|
||||
// Copy the config.php.dist file to config.php and update it with your keys to run the examples
|
||||
if ($siteKey == '' && is_readable(__DIR__ . '/config.php')) {
|
||||
$config = include __DIR__ . '/config.php';
|
||||
$siteKey = $config['v3']['site'];
|
||||
$secret = $config['v3']['secret'];
|
||||
}
|
||||
|
||||
// reCAPTCHA supports 40+ languages listed here: https://developers.google.com/recaptcha/docs/language
|
||||
$lang = 'en';
|
||||
|
||||
// The v3 API lets you provide some context for the check by specifying an action.
|
||||
// See: https://developers.google.com/recaptcha/docs/v3
|
||||
$pageAction = 'examples/v3scores';
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width,height=device-height,minimum-scale=1">
|
||||
<link rel="shortcut icon" href="https://www.gstatic.com/recaptcha/admin/favicon.ico" type="image/x-icon"/>
|
||||
<link rel="canonical" href="https://recaptcha-demo.appspot.com/recaptcha-v3-request-scores.php">
|
||||
<script type="application/ld+json">{ "@context": "http://schema.org", "@type": "WebSite", "name": "reCAPTCHA demo - Request scores", "url": "https://recaptcha-demo.appspot.com/recaptcha-v3-request-scores.php" }</script>
|
||||
<meta name="description" content="reCAPTCHA demo - Request scores" />
|
||||
<meta property="og:url" content="https://recaptcha-demo.appspot.com/recaptcha-v3-request-scores.php" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="reCAPTCHA demo - Request scores" />
|
||||
<meta property="og:description" content="reCAPTCHA demo - Request scores" />
|
||||
<link rel="stylesheet" type="text/css" href="/examples.css">
|
||||
<title>reCAPTCHA demo - Request scores</title>
|
||||
<header>
|
||||
<h1>reCAPTCHA demo</h1><h2>Request scores</h2>
|
||||
<p><a href="/">↩️ Home</a></p>
|
||||
</header>
|
||||
<main>
|
||||
<?php
|
||||
if ($siteKey === '' || $secret === ''):
|
||||
?>
|
||||
<h2>Add your keys</h2>
|
||||
<p>If you do not have keys already then visit <kbd> <a href = "https://www.google.com/recaptcha/admin">https://www.google.com/recaptcha/admin</a></kbd> to generate them. Edit this file and set the respective keys in <kbd>$siteKey</kbd> and <kbd>$secret</kbd>. Reload the page after this.</p>
|
||||
<?php
|
||||
else:
|
||||
// Add the g-recaptcha tag to the form you want to include the reCAPTCHA element
|
||||
?>
|
||||
<p>The reCAPTCHA v3 API provides a confidence score for each request.</p>
|
||||
<p><strong>NOTE:</strong>This is a sample implementation, the score returned here is not a reflection on your Google account or type of traffic. In production, refer to the distribution of scores shown in <a href="https://www.google.com/recaptcha/admin" target="_blank">your admin interface</a> and adjust your own threshold accordingly. <strong>Do not raise issues regarding the score you see here.</strong></p>
|
||||
<ol id="recaptcha-steps">
|
||||
<li class="step0">reCAPTCHA script loading</li>
|
||||
<li class="step1 hidden"><kbd>grecaptcha.ready()</kbd> fired, calling <pre>grecaptcha.execute('<?php echo $siteKey; ?>', {action: '<?php echo $pageAction; ?>'})'</pre></li>
|
||||
<li class="step2 hidden">Received token from reCAPTCHA service, sending to our backend with:
|
||||
<pre class="token">fetch('/recaptcha-v3-verify.php?token=abc123</pre></li>
|
||||
<li class="step3 hidden">Received response from our backend: <pre class="response">{"json": "from-backend"}</pre></li>
|
||||
</ol>
|
||||
<p><a href="/recaptcha-v3-request-scores.php">⤴️ Try again</a></p>
|
||||
<script src="https://www.google.com/recaptcha/api.js?render=<?php echo $siteKey; ?>"></script>
|
||||
<script>
|
||||
const steps = document.getElementById('recaptcha-steps');
|
||||
grecaptcha.ready(function() {
|
||||
document.querySelector('.step1').classList.remove('hidden');
|
||||
grecaptcha.execute('<?php echo $siteKey; ?>', {action: '<?php echo $pageAction; ?>'}).then(function(token) {
|
||||
document.querySelector('.token').innerHTML = 'fetch(\'/recaptcha-v3-verify.php?action=<?php echo $pageAction; ?>&token=\'' + token;
|
||||
document.querySelector('.step2').classList.remove('hidden');
|
||||
|
||||
fetch('/recaptcha-v3-verify.php?action=<?php echo $pageAction; ?>&token='+token).then(function(response) {
|
||||
response.json().then(function(data) {
|
||||
document.querySelector('.response').innerHTML = JSON.stringify(data, null, 2);
|
||||
document.querySelector('.step3').classList.remove('hidden');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
endif;?>
|
||||
</main>
|
||||
<!-- Google Analytics - just ignore this -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-123057962-1"></script>
|
||||
<script>window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-123057962-1');</script>
|
||||
59
user/plugins/form/vendor/google/recaptcha/examples/recaptcha-v3-verify.php
vendored
Normal file
59
user/plugins/form/vendor/google/recaptcha/examples/recaptcha-v3-verify.php
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* BSD 3-Clause License
|
||||
* @copyright (c) 2019, Google Inc.
|
||||
* @link https://www.google.com/recaptcha
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
require __DIR__ . '/appengine-https.php';
|
||||
|
||||
// Initiate the autoloader. The file should be generated by Composer.
|
||||
// You will provide your own autoloader or require the files directly if you did
|
||||
// not install via Composer.
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
// Register API keys at https://www.google.com/recaptcha/admin
|
||||
$siteKey = '';
|
||||
$secret = '';
|
||||
|
||||
// Copy the config.php.dist file to config.php and update it with your keys to run the examples
|
||||
if ($siteKey == '' && is_readable(__DIR__ . '/config.php')) {
|
||||
$config = include __DIR__ . '/config.php';
|
||||
$siteKey = $config['v3']['site'];
|
||||
$secret = $config['v3']['secret'];
|
||||
}
|
||||
|
||||
// Effectively we're providing an API endpoint here that will accept the token, verify it, and return the action / score to the page
|
||||
// In production, always sanitize and validate the input you retrieve from the request.
|
||||
$recaptcha = new \ReCaptcha\ReCaptcha($secret);
|
||||
$resp = $recaptcha->setExpectedHostname($_SERVER['SERVER_NAME'])
|
||||
->setExpectedAction($_GET['action'])
|
||||
->setScoreThreshold(0.5)
|
||||
->verify($_GET['token'], $_SERVER['REMOTE_ADDR']);
|
||||
header('Content-type:application/json');
|
||||
echo json_encode($resp->toArray());
|
||||
2
user/plugins/form/vendor/google/recaptcha/examples/robots.txt
vendored
Normal file
2
user/plugins/form/vendor/google/recaptcha/examples/robots.txt
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
User-agent: *
|
||||
Disallow:
|
||||
Reference in New Issue
Block a user