Issue in integration with Wordpress login form.
biplavsitaula1 opened this issue · 2 comments
I am customizing wp login form and trying to integrate this captcha method, but it loads as verifying and verifying is never complete. I have created challengeurl endpoint. The endpoint respose is 200 with correct data. But the verifying is not complete and hidden input field with some encrypted text is not seen in dom.
As I am getting error in console as undefined reading digest. If I log event on state change, the payload is null.
I am injecting altcha-widget using vanilla js and backend is handled using php in Wordpress.
Error: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'digest')
JS code:
import "./styles/main.scss";
import { altcha } from "altcha";
document.addEventListener("DOMContentLoaded", function () {
const passBox = document.querySelector(".user-pass-wrap");
const widgetElement = document.createElement("altcha-widget");
widgetElement.setAttribute("challengeurl", "/wp-json/altcha/v1/challenge");
widgetElement.style.setProperty("--altcha-max-width", "100%");
passBox.insertAdjacentElement("afterend", widgetElement);
widgetElement.addEventListener("stateChange", (event) => {
console.log(event);
});
});
Should I need add projectid and sitekey to update statechange? This is not seen in example is vue and laravel.
Hi, you have to run the website in a "secure context" (HTTPS), otherwise the browser's crypto module is not available (see https://altcha.org/docs/website-integration/#caveats).
The issue was with secure connection. Thanks for the help.