File tree Expand file tree Collapse file tree 2 files changed +30
-50
lines changed Expand file tree Collapse file tree 2 files changed +30
-50
lines changed Original file line number Diff line number Diff line change 88 align =" center"
99 >
1010 <h4 class =" pb-3" >Please complete the recaptcha to launch the app</h4 >
11- <Recaptcha :site_key =" site_key" />
11+ <ClientOnly >
12+ <vue-recaptcha
13+ ref =" recaptcha"
14+ :sitekey =" site_key"
15+ :loadRecaptchaScript =" true"
16+ @expired =" is_captcha_validated = false"
17+ @verify =" submit_recaptcha"
18+ align-self =" center"
19+ />
20+ </ClientOnly >
1221 </v-col >
1322 <v-col
1423 v-else-if =" !cloud_store.is_running && cloud_store.is_connexion_launched"
2029</template >
2130
2231<script setup>
32+ import { VueRecaptcha } from " vue-recaptcha"
2333 const websocket_store = use_websocket_store ()
2434 const cloud_store = use_cloud_store ()
2535 const { is_captcha_validated } = storeToRefs (cloud_store)
3343 }
3444 })
3545
36- onMounted (async () => {
37- console .log (" useRuntimeConfig()" , useRuntimeConfig ())
38- console .log (" site_key" , site_key)
46+ onMounted (() => {
47+ if (process .client ) {
48+ const config = useRuntimeConfig ()
49+ if (config .public .NODE_ENV !== " production" ) {
50+ cloud_store .$patch ({ is_captcha_validated: true })
51+ }
52+ }
3953 })
54+
55+ async function submit_recaptcha (token ) {
56+ try {
57+ const response = await $fetch .raw (
58+ ` /.netlify/functions/recaptcha?token=${ token} ` ,
59+ )
60+ cloud_store .$patch ({ is_captcha_validated: response .status == 200 })
61+ recaptcha .reset ()
62+ } catch (error) {
63+ console .error (error)
64+ }
65+ }
4066 </script >
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments