@geode/opengeodeweb-front 2.0.0-rc.25 → 2.0.0-rc.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Launcher.vue +30 -4
- package/package.json +1 -1
- package/components/Recaptcha.vue +0 -46
package/components/Launcher.vue
CHANGED
|
@@ -8,7 +8,16 @@
|
|
|
8
8
|
align="center"
|
|
9
9
|
>
|
|
10
10
|
<h4 class="pb-3">Please complete the recaptcha to launch the app</h4>
|
|
11
|
-
<
|
|
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>
|
|
12
21
|
</v-col>
|
|
13
22
|
<v-col
|
|
14
23
|
v-else-if="!cloud_store.is_running && cloud_store.is_connexion_launched"
|
|
@@ -20,6 +29,7 @@
|
|
|
20
29
|
</template>
|
|
21
30
|
|
|
22
31
|
<script setup>
|
|
32
|
+
import { VueRecaptcha } from "vue-recaptcha"
|
|
23
33
|
const websocket_store = use_websocket_store()
|
|
24
34
|
const cloud_store = use_cloud_store()
|
|
25
35
|
const { is_captcha_validated } = storeToRefs(cloud_store)
|
|
@@ -33,8 +43,24 @@
|
|
|
33
43
|
}
|
|
34
44
|
})
|
|
35
45
|
|
|
36
|
-
onMounted(
|
|
37
|
-
|
|
38
|
-
|
|
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
|
+
}
|
|
39
53
|
})
|
|
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
|
+
}
|
|
40
66
|
</script>
|
package/package.json
CHANGED
package/components/Recaptcha.vue
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<ClientOnly>
|
|
3
|
-
<vue-recaptcha
|
|
4
|
-
ref="recaptcha"
|
|
5
|
-
:sitekey="site_key"
|
|
6
|
-
:loadRecaptchaScript="true"
|
|
7
|
-
@expired="is_captcha_validated = false"
|
|
8
|
-
@verify="submit_recaptcha"
|
|
9
|
-
align-self="center"
|
|
10
|
-
/>
|
|
11
|
-
</ClientOnly>
|
|
12
|
-
</template>
|
|
13
|
-
|
|
14
|
-
<script setup>
|
|
15
|
-
import { VueRecaptcha } from "vue-recaptcha"
|
|
16
|
-
|
|
17
|
-
const cloud_store = use_cloud_store()
|
|
18
|
-
const { is_captcha_validated } = storeToRefs(cloud_store)
|
|
19
|
-
|
|
20
|
-
const props = defineProps({
|
|
21
|
-
site_key: { type: String, required: true },
|
|
22
|
-
})
|
|
23
|
-
const { site_key } = props
|
|
24
|
-
|
|
25
|
-
onMounted(() => {
|
|
26
|
-
console.log("recaptcha mounted", site_key)
|
|
27
|
-
if (process.client) {
|
|
28
|
-
const config = useRuntimeConfig()
|
|
29
|
-
if (config.public.NODE_ENV !== "production") {
|
|
30
|
-
cloud_store.$patch({ is_captcha_validated: true })
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
async function submit_recaptcha(token) {
|
|
36
|
-
try {
|
|
37
|
-
const response = await $fetch.raw(
|
|
38
|
-
`/.netlify/functions/recaptcha?token=${token}`,
|
|
39
|
-
)
|
|
40
|
-
cloud_store.$patch({ is_captcha_validated: response.status == 200 })
|
|
41
|
-
recaptcha.reset()
|
|
42
|
-
} catch (error) {
|
|
43
|
-
console.error(error)
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
</script>
|