The Gitlab instance will be restarted on Monday April 28th at 2AM. There will be a short interruption of service.

Skip to content
Snippets Groups Projects
Commit 33b2cc1a authored by Chris Hallberg's avatar Chris Hallberg Committed by Demian Katz
Browse files

Check for grecaptcha at all uses and formalize checks.

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