From 6fd2e02882007b3a94d19c43d7d9bb91a485a44b Mon Sep 17 00:00:00 2001 From: Francis Meetze Date: Wed, 23 Dec 2020 15:09:01 -0800 Subject: [PATCH 1/2] removed oninput call --- Views/init_v3.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Views/init_v3.php b/Views/init_v3.php index edee83a..bd87a04 100644 --- a/Views/init_v3.php +++ b/Views/init_v3.php @@ -9,8 +9,8 @@ grecaptcha.ready(function() { grecaptcha.execute('', ).then(function(token) { document.getElementById('').value = token; - document.getElementById('').oninput(); + // document.getElementById('').oninput(); }); }); - \ No newline at end of file + From 8ab0d25953f523c1690da0318f208a758469306b Mon Sep 17 00:00:00 2001 From: Francis Meetze Date: Wed, 14 Apr 2021 13:23:18 -0700 Subject: [PATCH 2/2] V3 Token Expiration Fix --- README.md | 10 +++++++--- Views/init_v3.php | 23 +++++++++++++++++++---- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 613bdbd..1925dd0 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ echo form_close(); ``` helper(['form', 'reCaptcha']); -echo form_open(); +echo form_open('/form_processing_path', array('id' => 'contactForm')); echo reCaptcha3('reCaptcha3', ['id' => 'recaptcha_v3'], ['action' => 'contactForm']); @@ -71,6 +71,10 @@ public $validationRules = [ ]; ``` -In the settings of the reCaptcha3 validator, the first parameter you specify is expectedAction, this parameter is not required. +In the settings of the reCaptcha3 validator, the first parameter you specify is +expectedAction. The form id attribute needs to share the same name as the action. +This allows grecaptcha.execute to be called on form submission to prevent token +expiration warnings. -You can override a global scoreThreshold parameter in the second reCaptcha3 rule parameter. \ No newline at end of file +You can override a global scoreThreshold parameter in the second reCaptcha3 rule +parameter. diff --git a/Views/init_v3.php b/Views/init_v3.php index bd87a04..d62ef34 100644 --- a/Views/init_v3.php +++ b/Views/init_v3.php @@ -7,10 +7,25 @@