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;
|
||||
}
|
||||
|
||||
const altchaWidget = form.querySelector('altcha-widget');
|
||||
const altchaValue = altchaWidget ? altchaWidget.value : '';
|
||||
const errAltcha = document.getElementById('err-altcha');
|
||||
if (errAltcha) errAltcha.style.display = 'none';
|
||||
|
||||
const altchaInput = form.querySelector('[name="altcha"]');
|
||||
const altchaValue = altchaInput?.value || '';
|
||||
if (!altchaValue) {
|
||||
const errEl = document.getElementById('err-altcha');
|
||||
if (errEl) { errEl.style.display = ''; }
|
||||
if (errAltcha) errAltcha.style.display = '';
|
||||
showAlert('Please complete the verification.', 'is-warning');
|
||||
altchaWidget && altchaWidget.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
form.querySelector('altcha-widget')?.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -145,7 +145,7 @@
|
||||
|
||||
<div class="field">
|
||||
<altcha-widget
|
||||
challengeurl="/api/altcha"
|
||||
challenge="/api/altcha"
|
||||
style="--altcha-color-border: #dbdbdb; --altcha-border-radius: 4px; --altcha-color-text: #363636;"
|
||||
></altcha-widget>
|
||||
<p class="help is-danger" id="err-altcha" style="display:none;">Please complete the verification.</p>
|
||||
|
||||
@ -220,7 +220,7 @@
|
||||
|
||||
<div class="field">
|
||||
<altcha-widget
|
||||
challengeurl="/api/altcha"
|
||||
challenge="/api/altcha"
|
||||
style="--altcha-color-border: #dbdbdb; --altcha-border-radius: 4px; --altcha-color-text: #363636;"
|
||||
></altcha-widget>
|
||||
<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