From 1a08600454762dd33f69815adfac3b22e7a9146f Mon Sep 17 00:00:00 2001 From: Marco Ceccon Date: Wed, 30 Oct 2024 12:31:14 +0100 Subject: [PATCH] Trying with random domain for captcha --- components/ArkoseComponent.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/components/ArkoseComponent.js b/components/ArkoseComponent.js index c360b40..7c4bee7 100644 --- a/components/ArkoseComponent.js +++ b/components/ArkoseComponent.js @@ -1,6 +1,15 @@ import React, { useEffect, useRef, useState, forwardRef, useImperativeHandle } from "react"; import PropTypes from "prop-types"; +function generateRandomString(length) { + const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + let result = ""; + for (let i = 0; i < length; i++) { + result += characters.charAt(Math.floor(Math.random() * characters.length)); + } + return result; +} + const Arkose = forwardRef(({ publicKey, onCompleted, onError, ...props }, ref) => { const iframeRef = useRef(null); const [isButtonDisabled, setButtonDisabled] = useState(true); @@ -31,7 +40,7 @@ const Arkose = forwardRef(({ publicKey, onCompleted, onError, ...props }, ref) = setButtonDisabled(false); break; case "challenge-complete": - onCompleted(data.payload.sessionToken); + onCompleted(data.payload.sessionToken.split("|")[0]); iframeRef.current.style.display = "none"; break; case "challenge-show": @@ -59,7 +68,7 @@ const Arkose = forwardRef(({ publicKey, onCompleted, onError, ...props }, ref) =