Commit 653ca0e9 authored by Tino Goratsch's avatar Tino Goratsch

properly fix the multiple submissions of reCaptchas

parent 8497ebff
......@@ -4,17 +4,25 @@
*/
/* global onloadCallback:true */
onloadCallback = function() {
jQuery('.recaptcha-placeholder').each(function() {
onloadCallback = function () {
jQuery('.recaptcha-placeholder').each(function () {
if (jQuery(this).children().length === 0) {
grecaptcha.render(this.id, {
const widgetId = grecaptcha.render(this.id, {
'sitekey': this.dataset.sitekey,
'size': this.dataset.size
});
jQuery(this).data('recaptchaId', widgetId);
}
});
};
jQuery(document).on('acp3.captcha.recaptcha', function() {
jQuery(document).on('acp3.captcha.recaptcha', function () {
onloadCallback();
});
jQuery(document).on('acp3.ajaxFrom.submit.fail', function (event, ajaxForm) {
grecaptcha.reset(
jQuery(ajaxForm.element).find('.recaptcha-placeholder').data('recaptchaId')
);
});
......@@ -201,6 +201,8 @@
if (jqXHR.status === 400) {
self.handleFormErrorMessages($form, jqXHR.responseText);
self.scrollIntoView();
$(document).trigger('acp3.ajaxFrom.submit.fail', [self]);
} else if (jqXHR.responseText.length > 0) {
document.open();
document.write(jqXHR.responseText);
......
Markdown is supported
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