@geode/opengeodeweb-front 9.12.3-rc.1 → 9.13.0

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.
@@ -8,8 +8,7 @@
8
8
  align-self="center"
9
9
  style="z-index: 1000"
10
10
  >
11
- <h4 class="pb-3">Please complete the recaptcha to launch the app</h4>
12
- <Recaptcha :site_key="site_key" />
11
+ <Recaptcha :color="'secondary'" />
13
12
  </v-col>
14
13
  <v-col v-else-if="infra_store.status == Status.CREATING">
15
14
  <Loading />
@@ -1,23 +1,74 @@
1
1
  <template>
2
- <ClientOnly>
3
- <vue-recaptcha
4
- ref="recaptcha"
5
- :sitekey="props.site_key"
6
- :load-recaptcha-script="true"
7
- align-self="center"
8
- @expired="infra_store.is_captcha_validated = false"
9
- @verify="submit_recaptcha"
10
- />
11
- </ClientOnly>
2
+ <VRow align="center" justify="center" style="display: none">
3
+ <VCol cols="4">
4
+ <VForm v-model="valid">
5
+ <VContainer>
6
+ <VRow>
7
+ <VCol>
8
+ <VTextField v-model="name" label="Name" required />
9
+ </VCol>
10
+ </VRow>
11
+ <VRow>
12
+ <VCol>
13
+ <VTextField
14
+ v-model="email"
15
+ :rules="emailRules"
16
+ label="E-mail"
17
+ required
18
+ />
19
+ </VCol>
20
+ </VRow>
21
+ <VRow>
22
+ <VCol>
23
+ <VCheckbox label="Launch the app" v-model="launch" />
24
+ </VCol>
25
+ </VRow>
26
+ </VContainer>
27
+ </VForm>
28
+ </VCol>
29
+ </VRow>
30
+ <VRow align="center" justify="center">
31
+ <VCol cols="4" class="d-flex justify-center align-center">
32
+ <VBtn
33
+ :text="props.button_label"
34
+ :color="props.button_color"
35
+ @click="submit_recaptcha"
36
+ />
37
+ </VCol>
38
+ </VRow>
12
39
  </template>
13
40
 
14
41
  <script setup>
15
- import { VueRecaptcha } from "vue-recaptcha"
16
- const infra_store = useInfraStore()
17
-
18
42
  const props = defineProps({
19
- site_key: { type: String, required: true },
43
+ button_label: {
44
+ type: String,
45
+ required: false,
46
+ default: "Launch the app",
47
+ },
48
+ button_color: {
49
+ type: String,
50
+ required: false,
51
+ default: "white",
52
+ },
20
53
  })
54
+ const infra_store = useInfraStore()
55
+ const name = ref("")
56
+ const email = ref("")
57
+ const launch = ref(false)
58
+ const emailRules = [
59
+ (value) => {
60
+ if (value) {
61
+ return true
62
+ }
63
+ return "E-mail is required."
64
+ },
65
+ (value) => {
66
+ if (/.+@.+\..+/.test(value)) {
67
+ return true
68
+ }
69
+ return "E-mail must be valid."
70
+ },
71
+ ]
21
72
 
22
73
  onMounted(() => {
23
74
  if (import.meta.client) {
@@ -29,15 +80,18 @@
29
80
  }
30
81
  }
31
82
  })
32
- async function submit_recaptcha(token) {
33
- try {
34
- const response = await $fetch.raw(
35
- `/.netlify/functions/recaptcha?token=${token}`,
36
- )
37
- infra_store.$patch({ is_captcha_validated: response.status == 200 })
38
- recaptcha.reset()
39
- } catch (error) {
40
- console.error(error)
41
- }
83
+ function submit_recaptcha() {
84
+ $fetch(
85
+ `/.netlify/functions/recaptcha?name=${name.value}&email=${email.value}&launch=${launch.value}`,
86
+ {
87
+ onResponse({ response }) {
88
+ if (response.ok) {
89
+ infra_store.$patch({
90
+ is_captcha_validated: response.status === 200,
91
+ })
92
+ }
93
+ },
94
+ },
95
+ )
42
96
  }
43
97
  </script>
package/package.json CHANGED
@@ -40,11 +40,11 @@
40
40
  },
41
41
  "description": "OpenSource Vue/Nuxt/Pinia/Vuetify framework for web applications",
42
42
  "type": "module",
43
- "version": "9.12.3-rc.1",
43
+ "version": "9.13.0",
44
44
  "main": "./nuxt.config.js",
45
45
  "dependencies": {
46
- "@geode/opengeodeweb-back": "next",
47
- "@geode/opengeodeweb-viewer": "next",
46
+ "@geode/opengeodeweb-back": "latest",
47
+ "@geode/opengeodeweb-viewer": "latest",
48
48
  "@kitware/vtk.js": "33.3.0",
49
49
  "@mdi/font": "7.4.47",
50
50
  "@pinia/nuxt": "0.5.4",
@@ -60,7 +60,6 @@
60
60
  "sass": "1.87.0",
61
61
  "semver": "7.7.1",
62
62
  "uuid": "11.1.0",
63
- "vue-recaptcha": "2.0.3",
64
63
  "vue3-carousel": "0.3.4",
65
64
  "vuetify": "3.8.12",
66
65
  "ws": "8.18.3",
@@ -5,4 +5,4 @@
5
5
  # pip-compile --output-file=tests/integration/microservices/viewer/requirements.txt tests/integration/microservices/viewer/requirements.in
6
6
  #
7
7
 
8
- opengeodeweb-viewer==1.*,>=1.11.8
8
+ opengeodeweb-viewer==1.*,>=1.11.9rc1
@@ -0,0 +1,40 @@
1
+ // Third party imports
2
+ import { describe, expect, test } from "vitest"
3
+
4
+ // Local imports
5
+ import { check_recaptcha_params } from "~/utils/recaptcha.js"
6
+
7
+ describe("recaptcha.js", () => {
8
+ const name = ""
9
+ const email = ""
10
+ const launch = false
11
+ const internal_error = 500
12
+ const success = 200
13
+
14
+ describe("wrong params", () => {
15
+ test("name", () => {
16
+ const name = "test"
17
+ const result = check_recaptcha_params(name, email, launch)
18
+ expect(result.status).toBe(internal_error)
19
+ })
20
+
21
+ test("email", () => {
22
+ const email = "test"
23
+ const result = check_recaptcha_params(name, email, launch)
24
+ expect(result.status).toBe(internal_error)
25
+ })
26
+
27
+ test("launch", () => {
28
+ const launch = true
29
+ const result = check_recaptcha_params(name, email, launch)
30
+ expect(result.status).toBe(internal_error)
31
+ })
32
+ })
33
+
34
+ describe("right params", () => {
35
+ test("name", () => {
36
+ const result = check_recaptcha_params(name, email, launch)
37
+ expect(result.status).toBe(success)
38
+ })
39
+ })
40
+ })
@@ -0,0 +1,14 @@
1
+ function check_recaptcha_params(name, email, launch) {
2
+ if (name !== "") {
3
+ return { status: 500 }
4
+ }
5
+ if (email !== "") {
6
+ return { status: 500 }
7
+ }
8
+ if (launch !== false) {
9
+ return { status: 500 }
10
+ }
11
+ return { status: 200 }
12
+ }
13
+
14
+ export { check_recaptcha_params }