Fix ALTCHA widget not loading or submitting
Two bugs prevented form submission entirely: 1. `challengeurl` attribute was renamed to `challenge` in altcha v3 — the widget silently ignored the old name so it never fetched a challenge. 2. `altchaWidget.value` is not an exposed property on the v3 custom element; read the solved payload from the hidden `<input name="altcha">` the widget renders in light DOM instead. Also clears the err-altcha error message at the start of each submit attempt so it doesn't linger after the user completes verification and retries. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
5e6b201336
commit
01cad11472
@ -141,13 +141,15 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const altchaWidget = form.querySelector('altcha-widget');
|
const errAltcha = document.getElementById('err-altcha');
|
||||||
const altchaValue = altchaWidget ? altchaWidget.value : '';
|
if (errAltcha) errAltcha.style.display = 'none';
|
||||||
|
|
||||||
|
const altchaInput = form.querySelector('[name="altcha"]');
|
||||||
|
const altchaValue = altchaInput?.value || '';
|
||||||
if (!altchaValue) {
|
if (!altchaValue) {
|
||||||
const errEl = document.getElementById('err-altcha');
|
if (errAltcha) errAltcha.style.display = '';
|
||||||
if (errEl) { errEl.style.display = ''; }
|
|
||||||
showAlert('Please complete the verification.', 'is-warning');
|
showAlert('Please complete the verification.', 'is-warning');
|
||||||
altchaWidget && altchaWidget.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
form.querySelector('altcha-widget')?.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -145,7 +145,7 @@
|
|||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<altcha-widget
|
<altcha-widget
|
||||||
challengeurl="/api/altcha"
|
challenge="/api/altcha"
|
||||||
style="--altcha-color-border: #dbdbdb; --altcha-border-radius: 4px; --altcha-color-text: #363636;"
|
style="--altcha-color-border: #dbdbdb; --altcha-border-radius: 4px; --altcha-color-text: #363636;"
|
||||||
></altcha-widget>
|
></altcha-widget>
|
||||||
<p class="help is-danger" id="err-altcha" style="display:none;">Please complete the verification.</p>
|
<p class="help is-danger" id="err-altcha" style="display:none;">Please complete the verification.</p>
|
||||||
|
|||||||
@ -220,7 +220,7 @@
|
|||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<altcha-widget
|
<altcha-widget
|
||||||
challengeurl="/api/altcha"
|
challenge="/api/altcha"
|
||||||
style="--altcha-color-border: #dbdbdb; --altcha-border-radius: 4px; --altcha-color-text: #363636;"
|
style="--altcha-color-border: #dbdbdb; --altcha-border-radius: 4px; --altcha-color-text: #363636;"
|
||||||
></altcha-widget>
|
></altcha-widget>
|
||||||
<p class="help is-danger" id="err-altcha" style="display:none;">Please complete the verification.</p>
|
<p class="help is-danger" id="err-altcha" style="display:none;">Please complete the verification.</p>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user