Skip to content

Commit

Permalink
Merge branch 'dev/8.13'
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronSadlerUK committed May 17, 2022
2 parents 682aa0d + 82b6cce commit c87fa96
Show file tree
Hide file tree
Showing 2,776 changed files with 430,408 additions and 18 deletions.
8 changes: 4 additions & 4 deletions Builds/NuGet/UmbracoForms.uCaptcha.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package >
<metadata>
<id>AaronSadler.uCaptcha</id>
<version>1.0.3</version>
<version>1.0.4</version>
<title>UmbracoForms.uCaptcha</title>
<authors>Aaron Sadler</authors>
<owners>Aaron Sadler</owners>
Expand All @@ -17,9 +17,9 @@
<tags>umbraco, umbraco-cms, hCaptcha, umbraco-forms, reCaptcha</tags>
<dependencies>
<group targetFramework=".NETFramework4.7.2">
<dependency id="UmbracoForms" version="8.7.0" />
<dependency id="UmbracoForms.Core" version="8.7.0" />
<dependency id="UmbracoCms" version="8.6.1" />
<dependency id="UmbracoForms" version="8.7.3" />
<dependency id="UmbracoForms.Core" version="8.7.3" />
<dependency id="UmbracoCms" version="8.13.0" />
</group>
</dependencies>
</metadata>
Expand Down
4 changes: 2 additions & 2 deletions Builds/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
<info>
<package>
<name>UmbracoForms.uCaptcha</name>
<version>1.0.3</version>
<version>1.0.4</version>
<iconUrl></iconUrl>
<licence url="https://opensource.org/licenses/MIT">MIT</licence>
<url>https://github.com/AaronSadlerUK/UmbracoForms.uCaptcha</url>
<requirements type="strict">
<major>8</major>
<minor>6</minor>
<minor>13</minor>
<patch>0</patch>
</requirements>
</package>
Expand Down
2 changes: 2 additions & 0 deletions TestSite-V8.7.3/App_Data/packages/installedPackages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<packages />
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//hCaptcha callback
function onSubmit(token) {
//Find form which triggered hCaptcha
var uf = $("form");
uf.each(function () {
if ($(this).find('.h-captcha-response').val(token)) {
//Set hidden field to true if response matches
$(this).find('.u-captcha-bool').val("true");
}
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
var submittedFormId = null;

//hCaptcha callback
function onSubmit(token) {
//Get form container with the id set earlier
var frm = $("#" + submittedFormId);
var form = frm.find('form').first();
//Check we have the correct form by comparing response token
if (form.length > 0 && form.find(".h-captcha-response").val(token)) {
//Set hCaptcha field to true
form.find(".u-captcha-bool").val("true");
//Submit the form
form.submit();
}
}

function validate() {
//trigger hCaptcha
hcaptcha.execute();
}

//Remove umbraco forms click event
$(".umbraco-forms-form input[type=submit]").not(".cancel").off('click');

//Replace with hCaptcha trigger
$(".umbraco-forms-form input[type=submit]").not(".cancel").click(function (evt) {
evt.preventDefault();
var self = $(this);
var frm = self.closest("form");
//Validate the form as per usual Umbraco forms way
frm.validate();
if (frm.valid()) {
//Set form id for easy form finding on call back
submittedFormId = frm.parent(".umbraco-forms-form").attr('id');
//Start hCaptcha process
validate();
//Disable submit button
self.attr("disabled", "disabled");
}
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
var submittedFormId = null;

//hCaptcha callback
function onSubmit(token) {
//Get form container with the id set earlier
var frm = $("#" + submittedFormId);
var form = frm.find('form').first();
//Check we have the correct form by comparing response token
if (form.length > 0 && form.find(".g-captcha-response").val(token)) {
//Set hCaptcha field to true
form.find(".u-captcha-bool").val("true");
//Submit the form
form.submit();
}
}

function validate() {
//trigger hCaptcha
hcaptcha.execute();
}

//Remove umbraco forms click event
$(".umbraco-forms-form input[type=submit]").not(".cancel").off('click');

//Replace with hCaptcha trigger
$(".umbraco-forms-form input[type=submit]").not(".cancel").click(function (evt) {
evt.preventDefault();
var self = $(this);
var frm = self.closest("form");
//Validate the form as per usual Umbraco forms way
frm.validate();
if (frm.valid()) {
//Set form id for easy form finding on call back
submittedFormId = frm.parent(".umbraco-forms-form").attr('id');
//Start hCaptcha process
validate();
//Disable submit button
self.attr("disabled", "disabled");
}
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//hCaptcha callback
function onSubmit(token) {
//Find form which triggered hCaptcha
var uf = $("form");
uf.each(function () {
if ($(this).find('.g-captcha-response').val(token)) {
//Set hidden field to true if response matches
$(this).find('.u-captcha-bool').val("true");
}
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<img src="/App_Plugins/UmbracoForms.uCaptcha/Images/uCaptcha.png" style="max-height: 90px;" />
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c87fa96

Please sign in to comment.