diff --git a/src/backend/src/services/PuterHomepageService.js b/src/backend/src/services/PuterHomepageService.js index 858ad49ac..ddb5cbbc0 100644 --- a/src/backend/src/services/PuterHomepageService.js +++ b/src/backend/src/services/PuterHomepageService.js @@ -125,6 +125,9 @@ class PuterHomepageService extends BaseService { login: req.captchaRequired, signup: req.captchaRequired, }; + + // cloudflare turnstile site key + const turnstileSiteKey = config.services?.['cloudflare-turnstile']?.enabled ? config.services?.['cloudflare-turnstile']?.site_key : null; return res.send(this.generate_puter_page_html({ env: config.env, @@ -166,8 +169,7 @@ class PuterHomepageService extends BaseService { co_isolation_enabled: req.co_isolation_enabled, // Add captcha requirements to GUI parameters captchaRequired: captchaRequired, - // Add Turnstile site key to GUI parameters - turnstileSiteKey: config.services?.['cloudflare-turnstile']?.site_key, + turnstileSiteKey: turnstileSiteKey, }, })); } diff --git a/src/gui/src/UI/UIWindowSignup.js b/src/gui/src/UI/UIWindowSignup.js index de184f35a..51e1df926 100644 --- a/src/gui/src/UI/UIWindowSignup.js +++ b/src/gui/src/UI/UIWindowSignup.js @@ -22,16 +22,6 @@ import UIWindowLogin from './UIWindowLogin.js' import UIWindowEmailConfirmationRequired from './UIWindowEmailConfirmationRequired.js' import check_password_strength from '../helpers/check_password_strength.js' -// Helper function to reset Turnstile state -const resetTurnstile = (el_window) => { - if (window.turnstile) { - window.turnstile.reset('.cf-turnstile'); - $(el_window).find('.cf-turnstile').removeAttr('data-token'); - $(el_window).find('.cf-turnstile').removeClass('captcha-completed'); - $(el_window).find('.signup-btn').prop('disabled', true); - } -}; - function UIWindowSignup(options){ options = options ?? {}; options.reload_on_success = options.reload_on_success ?? true; @@ -89,7 +79,7 @@ function UIWindowSignup(options){ // bot trap - if this value is submitted server will ignore the request h += ``; - // Turnstile widget + // Turnstile widget (only when enabled) if(window.gui_params?.turnstileSiteKey){ h += `