Skip to content

Commit 9a4d195

Browse files
brianhallmadblex
authored andcommitted
Pass captcha container element to getSolveCallback (#1576)
1 parent 1ef3543 commit 9a4d195

File tree

5 files changed

+9
-5
lines changed

5 files changed

+9
-5
lines changed

injected/src/features/broker-protection/captcha-services/captcha.service.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,6 @@ export function solveCaptcha(action, token, root = document) {
129129
return SuccessResponse.create({
130130
actionID,
131131
actionType,
132-
response: { callback: { eval: captchaSolveProvider.getSolveCallback(token) } },
132+
response: { callback: { eval: captchaSolveProvider.getSolveCallback(captchaContainer, token) } },
133133
});
134134
}

injected/src/features/broker-protection/captcha-services/providers/cloudflare-turnstile.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@ export class CloudFlareTurnstileProvider {
4848
}
4949

5050
/**
51+
* @param {HTMLElement} captchaContainerElement - The element containing the captcha
5152
* @param {string} token - The solved captcha token
5253
*/
53-
getSolveCallback(token) {
54+
getSolveCallback(captchaContainerElement, token) {
5455
return null;
5556
}
5657
}

injected/src/features/broker-protection/captcha-services/providers/hcaptcha.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@ export class HCaptchaProvider {
4848
}
4949

5050
/**
51+
* @param {HTMLElement} captchaContainerElement - The element containing the captcha
5152
* @param {string} token - The solved captcha token
5253
*/
53-
getSolveCallback(token) {
54+
getSolveCallback(captchaContainerElement, token) {
5455
return null;
5556
}
5657
}

injected/src/features/broker-protection/captcha-services/providers/provider.interface.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,11 @@ export class CaptchaProvider {
6666
/**
6767
* Creates a callback function to execute when the captcha is solved
6868
* @abstract
69+
* @param {HTMLElement} captchaContainerElement - The element containing the captcha
6970
* @param {string} token - The solved captcha token
7071
* @returns {PirError|string|null} Callback function to execute when the captcha is solved
7172
*/
72-
getSolveCallback(token) {
73+
getSolveCallback(captchaContainerElement, token) {
7374
throw new Error('getSolveCallback() missing implementation');
7475
}
7576
}

injected/src/features/broker-protection/captcha-services/providers/recaptcha.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,10 @@ export class ReCaptchaProvider {
5757
}
5858

5959
/**
60+
* @param {HTMLElement} captchaContainerElement - The element containing the captcha
6061
* @param {string} token
6162
*/
62-
getSolveCallback(token) {
63+
getSolveCallback(captchaContainerElement, token) {
6364
return stringifyFunction({
6465
functionBody: captchaCallback,
6566
functionName: 'captchaCallback',

0 commit comments

Comments
 (0)