forked from leftypol/leftypol
main.js: extract captcha reset
This commit is contained in:
parent
1eaa0f7631
commit
30d0b3bfe4
1 changed files with 4 additions and 7 deletions
|
@ -259,17 +259,15 @@ function onCaptchaLoadTurnstile(action) {
|
||||||
action: action,
|
action: action,
|
||||||
});
|
});
|
||||||
if (widgetId === undefined) {
|
if (widgetId === undefined) {
|
||||||
console.error('Could not render Turnstile captcha!');
|
return null;
|
||||||
return undefined;
|
|
||||||
}
|
}
|
||||||
document.addEventListener('post', function(e) {
|
|
||||||
// User posted! Reset the captcha.
|
|
||||||
turnstile.reset(widgetId);
|
|
||||||
});
|
|
||||||
return widgetId;
|
return widgetId;
|
||||||
},
|
},
|
||||||
remove: function(widgetId) {
|
remove: function(widgetId) {
|
||||||
turnstile.remove(widgetId);
|
turnstile.remove(widgetId);
|
||||||
|
},
|
||||||
|
reset: function(widgetId) {
|
||||||
|
turnstile.reset(widgetId);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -288,7 +286,6 @@ function onCaptchaLoad(renderer) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
{% if config.dynamic_captcha %}
|
|
||||||
function isDynamicCaptchaEnabled() {
|
function isDynamicCaptchaEnabled() {
|
||||||
let cookie = getCookie('captcha-required');
|
let cookie = getCookie('captcha-required');
|
||||||
return cookie === '1';
|
return cookie === '1';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue