Skip to content

Commit

Permalink
Use dummy CAPTCHA site key in default config (#3332)
Browse files Browse the repository at this point in the history
  • Loading branch information
imnasnainaec authored Sep 25, 2024
1 parent 788558a commit 2184716
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion deploy/helm/thecombine/charts/frontend/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ imageName: combine_frontend
# The additional domain list is a space-separated string list of domains
combineAddlDomainList: ""
configAnalyticsWriteKey: ""
configCaptchaSiteKey: "None - defined in profiles"
configCaptchaSiteKey: ""
configOffline: false
configShowCertExpiration: false
10 changes: 1 addition & 9 deletions src/components/Login/Captcha.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@ export default function Captcha(props: CaptchaProps): ReactElement {
setSuccess(!isRequired.current);
}, [isRequired, setSuccess]);

const siteKey =
process.env.NODE_ENV === "production"
? RuntimeConfig.getInstance().captchaSiteKey()
: // https://developers.cloudflare.com/turnstile/troubleshooting/testing/
// has dummy site keys for development and testing; options are
// invisible pass, invisible fail, visible pass, visible fail, forced interaction
"1x00000000000000000000AA"; // visible pass

const fail = (): void => {
setSuccess(false);
toast.error(t("captcha.error"));
Expand All @@ -49,7 +41,7 @@ export default function Captcha(props: CaptchaProps): ReactElement {
onExpire={fail}
onSuccess={verify}
options={{ language: i18n.resolvedLanguage, theme: "light" }}
siteKey={siteKey}
siteKey={RuntimeConfig.getInstance().captchaSiteKey()}
/>
) : (
<Fragment />
Expand Down
5 changes: 4 additions & 1 deletion src/types/runtimeConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ declare global {
const defaultConfig: RuntimeConfigItems = {
baseUrl: "http://localhost:5000",
captchaRequired: true,
captchaSiteKey: "0x4AAAAAAAiMciPlBW1aA1iL",
/* https://developers.cloudflare.com/turnstile/troubleshooting/testing/
* has dummy site keys for development and testing; options are:
* invisible pass, invisible fail, visible pass, visible fail, forced interaction */
captchaSiteKey: "1x00000000000000000000AA", // visible pass
offline: false,
emailServicesEnabled: true,
showCertExpiration: true,
Expand Down

0 comments on commit 2184716

Please sign in to comment.