Browse Source

add ReCaptcha v3 to contact form

windhamdavid 1 month ago
parent
commit
0ed1c35c85
1 changed files with 9 additions and 2 deletions
  1. 9 2
      contact.html

+ 9 - 2
contact.html

@@ -124,7 +124,6 @@
 							</div>
 						</div>
 						<input type="hidden" name="recaptcha_response" id="recaptchaResponse">
-						
 					</form>
 				
 				</div>
@@ -381,11 +380,19 @@
 <script src="js/bootstrap-material-design.min.js"></script>
 <script src="js/material-kit.min.js"></script>
 <script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyB7ggSZufhKYdFE5PfBcy6aS4xnaX4-O_0"></script>
-<script async defer src="https://www.google.com/recaptcha/api.js?render=6Ld-Jq8UAAAAAIiecUb4JD3KmBRITjoMD_sbHkn0"></script>
+<script async defer src="https://www.google.com/recaptcha/api.js?render=6LfEJ68UAAAAACM33sd3g4PMnZtz64WSoJiIV354"></script>
 <script src="js/instagram.js"></script>
 <script src="js/map.js"></script>
 <script src="js/init.js"></script>
 <script src="js/validator.js"></script>
 <script src="forms/contact.js"></script>
+    <script>
+        grecaptcha.ready(function () {
+            grecaptcha.execute('6LfEJ68UAAAAACM33sd3g4PMnZtz64WSoJiIV354', { action: 'contact' }).then(function (token) {
+                var recaptchaResponse = document.getElementById('recaptchaResponse');
+                recaptchaResponse.value = token;
+            });
+        });
+    </script>
 </body>
 </html>