Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use dummy CAPTCHA site key in default config #3332

Merged
merged 8 commits into from
Sep 25, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ data:
CERT_ADDL_DOMAINS: {{ .Values.combineAddlDomainList | quote }}
CONFIG_USE_CONNECTION_URL: "true"
CONFIG_CAPTCHA_REQUIRED: {{ .Values.global.captchaRequired | quote | lower }}
{{- if .Values.configCaptchaSiteKey }}
CONFIG_CAPTCHA_SITE_KEY: {{ .Values.configCaptchaSiteKey | quote }}
{{- end }}
CONFIG_OFFLINE: {{ .Values.configOffline | quote | lower }}
CONFIG_EMAIL_ENABLED: {{ .Values.global.emailEnabled | quote | lower }}
CONFIG_SHOW_CERT_EXPIRATION: {{ .Values.configShowCertExpiration | quote | lower }}
Expand Down
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
6 changes: 0 additions & 6 deletions deploy/scripts/setup_files/profiles/dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ charts:
aws-login:
enabled: false

frontend:
# https://developers.cloudflare.com/turnstile/troubleshooting/testing/
# has dummy secret keys for development and testing; options are
# invisible pass, invisible fail, visible pass, visible fail, forced interaction
configCaptchaSiteKey: "1x00000000000000000000AA" # visible pass

global:
imageRegistry: ""
imagePullPolicy: IfNotPresent
Expand Down
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
Loading