Skip to content
Snippets Groups Projects
Commit c4d44be3 authored by Chris Hallberg's avatar Chris Hallberg
Browse files

Check for grecaptcha at all uses.

parent fe05004f
No related merge requests found
......@@ -163,9 +163,11 @@ function phoneNumberFormHandler(numID, regionCode) {
// Setup captchas after Google script loads
function recaptchaOnLoad() {
var captchas = $('.g-recaptcha:empty');
for (var i = 0; i < captchas.length; i++) {
captchas[i].dataset.captchaId = grecaptcha.render(captchas[i], captchas[i].dataset);
if (grecaptcha) {
var captchas = $('.g-recaptcha:empty');
for (var i = 0; i < captchas.length; i++) {
captchas[i].dataset.captchaId = grecaptcha.render(captchas[i], captchas[i].dataset);
}
}
}
......
......@@ -113,7 +113,9 @@ function registerAjaxCommentRecord() {
refreshCommentList($tab, id, recordSource);
$(form).find('textarea[name="comment"]').val('');
$(form).find('input[type="submit"]').button('loading');
grecaptcha.reset($(form).find('.g-recaptcha').data('captchaId'));
if (grecaptcha) {
grecaptcha.reset($(form).find('.g-recaptcha').data('captchaId'));
}
})
.fail(function addCommentFail(response, textStatus) {
if (textStatus === 'abort' || typeof response.responseJSON === 'undefined') { return; }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment