Skip to content

Commit 9aed11f

Browse files
fix: newsletter subscribe
Signed-off-by: Dipankar Das <[email protected]>
1 parent e5f93cd commit 9aed11f

File tree

2 files changed

+6
-20
lines changed

2 files changed

+6
-20
lines changed

src/components/AppFooter.astro

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,7 @@ const isProduction = import.meta.env.PROD;
145145
<div class="sib-captcha sib-form-block mb-3">
146146
<div class="form__entry entry_block">
147147
<div class="form__label-row">
148-
<div class="cf-turnstile sib-visible-recaptcha" id="sib-captcha" data-sitekey="0x4AAAAAACEW9pOFvA0Drq8K" data-callback="handleCaptchaResponse"></div>
149-
<input type="hidden" id="g-recaptcha-response" name="g-recaptcha-response" class="sib-captcha-token" data-required="true" />
148+
<div class="cf-turnstile g-recaptcha" data-sitekey="0x4AAAAAACEW9pOFvA0Drq8K" id="sib-captcha" data-callback="handleCaptchaResponse" data-language="en"></div>
150149
</div>
151150
<label class="entry__error entry__error--primary" style="font-size:14px; text-align:left; font-family:'Inter', Helvetica, sans-serif; display:none;"></label>
152151
</div>

src/layouts/Layout.astro

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -181,29 +181,16 @@ const { title = "ksctl - Strive towards Fast, Efficient and Sustainable Computin
181181

182182
<!-- Brevo Form Scripts -->
183183
<script is:inline>
184-
// Turnstile/reCAPTCHA callback function
184+
// Turnstile callback function - matches Brevo's Cloudflare Turnstile template
185185
window.handleCaptchaResponse = function(token) {
186186
console.log('Captcha completed:', token);
187187

188-
// Set the token in the hidden input field that Brevo expects
189-
var tokenInput = document.getElementById('g-recaptcha-response');
190-
if (tokenInput) {
191-
tokenInput.value = token;
192-
}
193-
194-
// Trigger the captchaChange event for Brevo
188+
// Dispatch captchaChange event for Brevo
195189
var event = new Event('captchaChange');
196-
var captchaElement = document.getElementById('sib-captcha');
197-
if (captchaElement) {
198-
captchaElement.dataset.captchaToken = token;
199-
captchaElement.dispatchEvent(event);
200-
}
190+
document.getElementById('sib-captcha').dispatchEvent(event);
201191

202-
// Also dispatch input event on the hidden field
203-
if (tokenInput) {
204-
var inputEvent = new Event('input', { bubbles: true });
205-
tokenInput.dispatchEvent(inputEvent);
206-
}
192+
// CRITICAL: Make Turnstile masquerade as reCAPTCHA for Brevo compatibility
193+
window.grecaptcha = window.turnstile;
207194
};
208195

209196
// Brevo form configuration (must be set before main.js loads)

0 commit comments

Comments
 (0)