Feat: Update CAPTCHA service to ALTCHA self-hosted.

This commit is contained in:
2025-03-15 17:47:36 +00:00
parent b843849af9
commit bade1f11dd
10 changed files with 3823 additions and 153 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,7 @@
// internal
import BasePage from "../base.js";
// vendor
import { Altcha } from "../../vendor/altcha.js";
export default class PageContact extends BasePage {
static hash = hashPageContact;
@@ -10,11 +12,12 @@ export default class PageContact extends BasePage {
initialize() {
this.sharedInitialize();
this.hookupCaptcha();
// this.hookupALTCHAByLocalServer();
this.hookupButtonSubmitFormContactUs();
}
hookupCaptcha() {
/*
hookupALTCHAByAPI() {
const form = document.querySelector(idContactForm);
const altchaWidget = form.querySelector('altcha-widget');
@@ -35,6 +38,22 @@ export default class PageContact extends BasePage {
});
}
}
*/
hookupALTCHAByLocalServer() {
window.ALTCHA = { init: (config) => {
document.querySelectorAll(config.selector).forEach(el => {
new Altcha({
target: el,
props: {
challengeurl: config.challenge.url,
auto: 'onload'
}
}).$on('verified', (e) => {
config.challenge.onSuccess(e.detail.payload, el);
});
});
}};
}
hookupButtonSubmitFormContactUs() {
const button = document.querySelector('form input[type="submit"]');