Add thank-you redirect, fix altcha payload read, add /thank-you/ route and page

This commit is contained in:
2026-06-05 10:18:24 +01:00
parent 2412acbe46
commit d1266b1c9d
3 changed files with 16 additions and 15 deletions
+9 -15
View File
@@ -34,9 +34,14 @@ document.addEventListener('DOMContentLoaded', function() {
if (form.elements['website']?.value) return;
// Get altcha value from the web component
const altchaWidget = document.getElementById('altcha-widget');
const altchaPayload = altchaWidget ? (altchaWidget.value || '') : '';
// Get altcha payload -- web component writes a hidden input[name=altcha] into the form
const altchaInput = form.querySelector('input[name="altcha"]');
const altchaPayload = altchaInput ? (altchaInput.value || '') : '';
if (!altchaPayload) {
formStatusDiv.className = 'form-status form-status--error';
formStatusDiv.innerHTML = '<p>Spam check not ready. Please wait a moment and try again.</p>';
return;
}
const payload = {
name: name,
@@ -63,18 +68,7 @@ document.addEventListener('DOMContentLoaded', function() {
const data = await response.json();
if (data.ok) {
formStatusDiv.className = 'form-status form-status--success';
formStatusDiv.innerHTML = '<p>Thank you! Your message has been sent. We\'ll be in touch soon.</p>';
form.reset();
if (formLoadedAtInput) {
formLoadedAtInput.value = Date.now().toString();
}
if (window.altcha) {
window.altcha = new Altcha({
challengeUrl: '/altcha-challenge/',
element: document.getElementById('altcha-widget')
});
}
window.location.href = '/thank-you/';
} else {
formStatusDiv.className = 'form-status form-status--error';
formStatusDiv.innerHTML = '<p>' + (data.error || 'An error occurred. Please try again.') + '</p>';
+7
View File
@@ -92,6 +92,13 @@ http {
fastcgi_pass 127.0.0.1:9000;
}
location = /thank-you/ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /var/www/html/src/api/router.php;
fastcgi_param QUERY_STRING type=page&slug=thank-you;
fastcgi_pass 127.0.0.1:9000;
}
set $router /var/www/html/src/api/router.php;
location = / {
Binary file not shown.