Skip to content

Beautiful Open-Source Form Builder

Refactor reCAPTCHA Variable Naming for Consistency

JhumanJ5962e7366aa4
diff --git a/client/components/forms/components/CaptchaInput.vue b/client/components/forms/components/CaptchaInput.vue
index 145c023fe..dcaa85edb 100644
--- a/client/components/forms/components/CaptchaInput.vue
+++ b/client/components/forms/components/CaptchaInput.vue
@@ -5,7 +5,7 @@
v-if="provider === 'recaptcha'"
:key="`recaptcha-${componentKey}`"
ref="captchaRef"
- :sitekey="recaptchaSiteKey"
+ :sitekey="reCaptchaSiteKey"
:theme="darkMode ? 'dark' : 'light'"
:language="language"
@verify="onCaptchaVerify"
@@ -58,7 +58,7 @@ const props = defineProps({
})
const config = useRuntimeConfig()
-const recaptchaSiteKey = config.public.recaptchaSiteKey
+const reCaptchaSiteKey = config.public.reCaptchaSiteKey
const hCaptchaSiteKey = config.public.hCaptchaSiteKey
const captchaRef = ref(null)
@@ -70,7 +70,7 @@ const formFieldName = computed(() => props.provider === 'recaptcha' ? 'g-recaptc
const isSiteKeyAvailable = computed(() => {
if (props.provider === 'recaptcha') {
- return !!recaptchaSiteKey
+ return !!reCaptchaSiteKey
} else if (props.provider === 'hcaptcha') {
return !!hCaptchaSiteKey
}
diff --git a/client/components/forms/components/CaptchaWrapper.vue b/client/components/forms/components/CaptchaWrapper.vue
index ab2778876..14f1abe5b 100644
--- a/client/components/forms/components/CaptchaWrapper.vue
+++ b/client/components/forms/components/CaptchaWrapper.vue
@@ -46,7 +46,7 @@ const isCaptchaRequired = computed(() => {
const captchaProvider = config.value.captcha_provider
if (captchaProvider === 'recaptcha') {
- return !!runtimeConfig.recaptchaSiteKey
+ return !!runtimeConfig.reCaptchaSiteKey
} else if (captchaProvider === 'hcaptcha') {
return !!runtimeConfig.hCaptchaSiteKey
}
diff --git a/client/components/open/forms/CaptchaWrapper.vue b/client/components/open/forms/CaptchaWrapper.vue
deleted file mode 100644
index 4705ce1ac..000000000
--- a/client/components/open/forms/CaptchaWrapper.vue
+++ /dev/null
@@ -1,14 +0,0 @@
-<template>
- <!-- No changes to template section -->
-</template>
-
-<script setup>
-defineProps({
- formManager: { type: Object, required: true },
- theme: { type: Object, required: false }
-})
-</script>
-
-<style>
- /* No changes to style section */
-</style>
\ No newline at end of file
diff --git a/client/components/open/forms/components/form-components/FormSecurityAccess.vue b/client/components/open/forms/components/form-components/FormSecurityAccess.vue
index 396c1c95d..8cd2bf5d5 100644
--- a/client/components/open/forms/components/form-components/FormSecurityAccess.vue
+++ b/client/components/open/forms/components/form-components/FormSecurityAccess.vue
@@ -73,7 +73,7 @@
Protect your form, and your sensitive files.
</p>
<div
- v-if="hasCaptchaProviders"
+ v-if="hasCaptcha"
class="flex items-start gap-6 flex-wrap"
>
<ToggleSwitchInput
@@ -100,14 +100,14 @@ const workingFormStore = useWorkingFormStore()
const { content: form } = storeToRefs(workingFormStore)
const config = useRuntimeConfig()
-const hasCaptchaProviders = computed(() => {
- return config.public.hCaptchaSiteKey || config.public.recaptchaSiteKey
+const hasCaptcha = computed(() => {
+ return config.public.hCaptchaSiteKey || config.public.reCaptchaSiteKey
})
const captchaOptions = computed(() => {
const options = []
- if (config.public.recaptchaSiteKey) {
+ if (config.public.reCaptchaSiteKey) {
options.push({ name: 'reCAPTCHA', value: 'recaptcha' })
}
diff --git a/client/components/pages/auth/components/RegisterForm.vue b/client/components/pages/auth/components/RegisterForm.vue
index 433f373c6..1f2c6bbb3 100644
--- a/client/components/pages/auth/components/RegisterForm.vue
+++ b/client/components/pages/auth/components/RegisterForm.vue
@@ -56,7 +56,7 @@
<!-- Captcha -->
<div
- v-if="recaptchaSiteKey"
+ v-if="reCaptchaSiteKey"
class="my-4 px-2 mx-auto w-max"
>
<CaptchaInput
@@ -184,8 +184,8 @@ export default {
}),
computed: {
- recaptchaSiteKey() {
- return this.runtimeConfig.public.recaptchaSiteKey
+ reCaptchaSiteKey() {
+ return this.runtimeConfig.public.reCaptchaSiteKey
},
hearAboutUsOptions() {
const options = [
@@ -240,7 +240,7 @@ export default {
const auth = useAuth()
// Reset captcha after submission
- if (import.meta.client && this.recaptchaSiteKey) {
+ if (import.meta.client && this.reCaptchaSiteKey) {
this.$refs.captcha.reset()
}
diff --git a/client/runtimeConfig.js b/client/runtimeConfig.js
index a7a5a7fee..357af2cca 100644
--- a/client/runtimeConfig.js
+++ b/client/runtimeConfig.js
@@ -10,7 +10,7 @@ export default {
appUrl: process.env.NUXT_PUBLIC_APP_URL || '',
env: process.env.NUXT_PUBLIC_ENV || 'local',
hCaptchaSiteKey: process.env.NUXT_PUBLIC_H_CAPTCHA_SITE_KEY || null,
- recaptchaSiteKey: process.env.NUXT_PUBLIC_RE_CAPTCHA_SITE_KEY || null,
+ reCaptchaSiteKey: process.env.NUXT_PUBLIC_RE_CAPTCHA_SITE_KEY || null,
gtmCode: process.env.NUXT_PUBLIC_GTM_CODE || null,
amplitudeCode: process.env.NUXT_PUBLIC_AMPLITUDE_CODE || null,
crispWebsiteId: process.env.NUXT_PUBLIC_CRISP_WEBSITE_ID || null,