Skip to content

Commit

Permalink
[IARMISK-3591] Remove BYPASS_CAPTCHA for auth0_v2 flows
Browse files Browse the repository at this point in the history
  • Loading branch information
TSLarson committed Jun 5, 2024
1 parent 89004f6 commit 93fca5e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
3 changes: 1 addition & 2 deletions src/__tests__/field/captcha/third_party_captcha.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ describe('ThirdPartyCaptcha', () => {
});
});

it('should retry 3 times on error and then set value to BYPASS_CAPTCHA dummy token for failOpen', () => {
it('should retry 3 times on error for failOpen', () => {
const renderParams = global.window.turnstile.render.mock.calls[0][1];
for (let i = 0; i < 3; i++) {
const renderParams = global.window.turnstile.render.mock.calls[i][1];
Expand All @@ -227,7 +227,6 @@ describe('ThirdPartyCaptcha', () => {

const { onChange } = wrapper.props;
expect(onChange.mock.calls).toHaveLength(1);
expect(onChange.mock.calls[0][0]).toBe('BYPASS_CAPTCHA');
});
});

Expand Down
13 changes: 6 additions & 7 deletions src/field/captcha/third_party_captcha.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export class ThirdPartyCaptcha extends React.Component {
this.props.onChange(value);
this.props.onErrored();
});
};
};
}

getRenderParams() {
Expand Down Expand Up @@ -157,17 +157,14 @@ export class ThirdPartyCaptcha extends React.Component {
this.setState(prevState => ({
retryCount: prevState.retryCount + 1
}));
} else {
// similar implementation to ARKOSE_PROVIDER failOpen
this.changeHandler('BYPASS_CAPTCHA');
}
return true;
}
};
}
return renderParams;
}

injectCaptchaScript(callback = noop) {
const { provider, hl, clientSubdomain, sitekey } = this.props;
const callbackName = `${providerDomPrefix(provider)}Callback_${Math.floor(Math.random() * 1000001)}`;
Expand All @@ -189,7 +186,9 @@ export class ThirdPartyCaptcha extends React.Component {
return;
}
removeScript(scriptUrl);
this.changeHandler('BYPASS_CAPTCHA');
if (provider === ARKOSE_PROVIDER) {
this.changeHandler('BYPASS_CAPTCHA');
}
};
window[callbackName] = arkose => {
callback(arkose);
Expand Down Expand Up @@ -252,7 +251,7 @@ export class ThirdPartyCaptcha extends React.Component {

reset() {
const provider = getCaptchaProvider(this.props.provider);
if (this.props.provider === FRIENDLY_CAPTCHA_PROVIDER) {
if (this.props.provider === FRIENDLY_CAPTCHA_PROVIDER) {
if (this.widgetInstance) {
this.widgetInstance.reset();
}
Expand Down

0 comments on commit 93fca5e

Please sign in to comment.