Now both login and signup check for Cloudflare Turnstile before allowing submission. The code checks window.turnstile.getResponse() - if it returns empty/falsy, the form submission is blocked with an error message.

This commit is contained in:
miles committed 2026-04-22 20:52:55 -05:00
1 parent a79c363cc6
commit 47c33b28a2
2 files changed
+24

No files matched your search

Vendored
BIN
View File
Binary file not shown.
+24
View File
@@ -3172,8 +3172,20 @@
function setSignupStatus(msg, kind){
fedlSetFormStatus(statusEl, msg, kind);
}
function checkTurnstile(){
const turnstileEl = window.turnstile;
if(turnstileEl){
const token = turnstileEl.getResponse();
if(!token){
setSignupStatus('Please complete the verification challenge.', 'error');
return false;
}
}
return true;
}
form.addEventListener('submit', function(ev){
ev.preventDefault();
if(!checkTurnstile()) return;
if (!canUseLiveServer) {
setSignupStatus('Sign up is not available right now.', 'error');
return;
@@ -3232,8 +3244,20 @@
function setLoginStatus(msg, kind){
fedlSetFormStatus(statusEl, msg, kind);
}
function checkTurnstile(){
const turnstileEl = window.turnstile;
if(turnstileEl){
const token = turnstileEl.getResponse();
if(!token){
setLoginStatus('Please complete the verification challenge.', 'error');
return false;
}
}
return true;
}
form.addEventListener('submit', function(ev){
ev.preventDefault();
if(!checkTurnstile()) return;
if (!canUseLiveServer) {
setLoginStatus('Log in is not available right now.', 'error');
return;