Skip to content

Commit

Permalink
Add Recaptcha v2 invisible version to register and contact pages
Browse files Browse the repository at this point in the history
  • Loading branch information
bensonpaul committed Jul 16, 2024
1 parent fca03f4 commit 5b13261
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 25 deletions.
7 changes: 5 additions & 2 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ unsafe = true
Description = "The first-in-class comprehensive digital healthcare suite of patient advocacy tools for patients and consumers who are determined to be empowered in their health care journey. Unblock Health is revolutionizing patient autonomy and healthcare consumerism."
logotitle ="Comprehensive Healthcare Suite of Patient Advocacy Services designed for Patients and Consumers - Unblock Health"
footersectionaboutcontent ="Unblock Health rejects traditional barriers to patient health information. We empower patients to play an active role in their care and help HIM professionals deliver a positive experience."
recaptchaSiteKey = "6LcwogEqAAAAAI2QtVzQNHKN2kE2zXkodWEUzHfD"
recaptchaSecretKey = "6LcwogEqAAAAAKLRTlccbN_3GVKb7O9SsCWsQxKe"
recaptchasitekey ="6LefMhAqAAAAAInXVvgjN5D_gPpa86RCAldVy7sm"
recaptchaurl = "https://www.google.com/recaptcha/api.js"
# Navigation
[params.navigation]
Expand Down Expand Up @@ -259,3 +258,7 @@ recaptchaSecretKey = "6LcwogEqAAAAAKLRTlccbN_3GVKb7O9SsCWsQxKe"
protocol = "http://"
[date]
date = ["enddate", ":default"]
[security]
enableInlineShortcodes = false
[security.funcs]
getenv = ['^HUGO_']
9 changes: 5 additions & 4 deletions layouts/partials/footer-new.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ <h3>Contact Us</h3>
<textarea class="form-control" placeholder="Message*" rows="3" name="Message" id="quickmessage" required></textarea>
</div>
<input type="hidden" name="_subject" value="[UnBlock Health] - Contact Form Submission" />
<input id="contact-submit" type="button" class="btn btn-send" value="Send">
<input id="contact-submit" type="button" class="btn btn-send" value="Send">
This site is protected by reCAPTCHA and the Google <a href="https://policies.google.com/privacy" target="_blank" class=" text-blue-600">Privacy Policy</a> and <a href="https://policies.google.com/terms" target="_blank" class=" text-blue-600">Terms of Service</a> apply.
<!--<button class="btn btn-send" id="contact-submit" type="submit">Send</button>-->
</form>
<div id="successfooter" style="display:none;">
Expand Down Expand Up @@ -180,10 +181,10 @@ <h3 class="slds-text-heading_medium medium" style="font-size: 24px; font-weight:
</div>

<input type="hidden" name="_subject" value="[UnBlock Health] - Contact Form Submission" />
<div class="slds-p-vertical_x-small g-recaptcha" data-sitekey="6LfG8v8pAAAAAL_bNl24ICh0nOSe5Yx2GnXOmhVD" data-callback="verifyCallback1"></div>
<button id="contact-submit" class="slds-button slds-button_brand slds-button_stretch slds-p-vertical_small slds-p-horizontal_medium slds-color__text_gray-1">
<!--<div class="slds-p-vertical_x-small g-recaptcha" data-sitekey="6LcwogEqAAAAAI2QtVzQNHKN2kE2zXkodWEUzHfD" data-callback="verifyCallback1"></div>-->
<button id="contact-submit" class="g-recaptcha slds-button slds-button_brand slds-button_stretch slds-p-vertical_small slds-p-horizontal_medium slds-color__text_gray-1" data-sitekey="{{ .context.Site.Params.recaptchasitekey}}" data-callback="verifyCallback0" data-size="invisible">
<span class="slds-text-body_small slds-text-title_caps slds-color__text_gray-1"><b>Send</b></span></button>

<div class="slds-form-element__control slds-m-bottom_medium">This site is protected by reCAPTCHA and the Google <a href="https://policies.google.com/privacy" target="_blank" class=" text-blue-600">Privacy Policy</a> and <a href="https://policies.google.com/terms" target="_blank" class=" text-blue-600">Terms of Service</a> apply.</div>
</div>
</form>

Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@

{{/* <script type="text/javascript" src="//script.crazyegg.com/pages/scripts/0092/8173.js" async="async"></script> */}}

<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<script src="{{.Site.Params.recaptchaurl}}" async defer></script>


</head>

Expand Down
7 changes: 4 additions & 3 deletions layouts/section/register.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{{ $context := . }}
{{- partialCached "head" (dict "activeMenu" "Register" "context" $context ) "register-page-key" -}}

<script src="{{.Site.Params.recaptchaurl}}" ></script>
<!-- main starts > -->
<main>
<section class="slds-color__background_gray-1 slds-p-vertical_x-large">
Expand Down Expand Up @@ -37,14 +37,14 @@ <h3 style="font-size:24px; line-height:34px;">{{ . }}</h3>
<option value="HIM">Hospital HIM</option>
</select>
</div>
<div class="slds-p-vertical_x-small g-recaptcha" data-sitekey="6LfG8v8pAAAAAL_bNl24ICh0nOSe5Yx2GnXOmhVD" data-callback="verifyCallback2"></div>
<!--<div class="slds-p-vertical_x-small g-recaptcha" data-sitekey="6LcwogEqAAAAAI2QtVzQNHKN2kE2zXkodWEUzHfD" data-callback="verifyCallback2"></div>-->
<input type="hidden" name="_subject" value="[UnBlock Health] - Contact Form Submission" />
<input type="hidden" name="_subject" value="[UnBlock Health] - Contact Form Submission" />
<input type="hidden" name="_novbaseurl" id="_novbaseurl" value={{.Site.Params.novuBaseURL}} />
<input type="hidden" name="_regformsupportemail" id="_regformsupportemail" value={{.Site.Params.unblockHealthSupportEmail}} />
</div>

<button class="slds-button slds-button_stretch slds-button_brand slds-p-around_medium slds-color__text_gray-1 slds-m-bottom_small" id="contact-submit-live">
<button class="g-recaptcha slds-button slds-button_stretch slds-button_brand slds-p-around_medium slds-color__text_gray-1 slds-m-bottom_small" id="contact-submit-live" data-sitekey="{{.Site.Params.recaptchasitekey}}" data-callback="verifyCallback2" data-size="invisible">
<span class="slds-text-heading_medium" style="font-size: 24px;text-transform:uppercase;"><b>Register</b></span></button>
</div>
<div class="loader-form" style="height:3rem;position:relative;width:100%;display:none;align-items: center;justify-content: center;">
Expand All @@ -55,6 +55,7 @@ <h3 style="font-size:24px; line-height:34px;">{{ . }}</h3>
</div>
</div>
</div>
<div class="slds-form-element__control slds-m-bottom_medium">This site is protected by reCAPTCHA and the Google <a href="https://policies.google.com/privacy" target="_blank" class=" text-blue-600">Privacy Policy</a> and <a href="https://policies.google.com/terms" target="_blank" class=" text-blue-600">Terms of Service</a> apply.</div>
</form>
<div id="success" style="display:none;">

Expand Down
32 changes: 18 additions & 14 deletions static/js/main-new.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,17 @@ $(document).ready(function () {
});


var verifyCallback0 ="";
/*var verifyCallback0 ="";
window.verifyCallback2 = function(response) {
verifyCallback0 = response;
};
var verifyCallback3 ="";
window.verifyCallback1 = function(response) {
verifyCallback3 = response;
};


//console.log(verifyCallback0);

};*/




$('#contact-submit-live').click(function (e) {
// Get server time using an HTTP request
Expand Down Expand Up @@ -70,11 +68,13 @@ console.log('EST Date:', estDateformat);*/


e.preventDefault();


var recaptcha_response = '';
var recaptcha_response = verifyCallback0;
console.log(recaptcha_response);

var verifyCallback1 ="";
window.verifyCallback2 = function(token) {
verifyCallback1 = token;
var recaptcha_response1 = '';
recaptcha_response1 = verifyCallback1;
console.log(recaptcha_response1);
var $errorfooter = $('#errorfooter'); // get the reference of the div
$errorfooter.show().html('');
var $success = $('#success');
Expand Down Expand Up @@ -158,7 +158,7 @@ console.log('EST Date:', estDateformat);*/
},
"data": JSON.stringify(registerFormData),
};*/
if(recaptcha_response) {
if(recaptcha_response1) {
$('.loader-form').show();
$('#error').hide();
$('#contact-submit-live').prop('disabled', 'disabled');
Expand Down Expand Up @@ -269,6 +269,7 @@ else{
var $error = $('#error'); // get the reference of the div
$error.show().html('Please select CAPTCHA');
}
};
});

$('#contact-submit-live').prop('disabled', 'disabled');
Expand All @@ -283,8 +284,10 @@ $('#contact-submit-live').prop('disabled', 'disabled');

$('#contact-submit').click(function (e) {
e.preventDefault();
var recaptchaResponse='';
var recaptcha_response = verifyCallback3;
var verifyCallback3 ="";
window.verifyCallback0 = function(token) {
var recaptcha_response='';
var recaptcha_response = token;
console.log(recaptcha_response);
var uid = uuidv4();
var first_name = $('#quickname').val();
Expand Down Expand Up @@ -379,6 +382,7 @@ $('#contact-submit-live').prop('disabled', 'disabled');
var $errorfooter = $('#errorfooter'); // get the reference of the div
$errorfooter.show().html('Please select CAPTCHA');
}
}
});


Expand Down

0 comments on commit 5b13261

Please sign in to comment.