Implement captcha element #67
Closed
adamberecz
started this conversation in
Ideas
Replies: 2 comments 2 replies
-
This is an implementation of Cloudflare's Turnstile captcha: <script>
import VueTurnstile from 'vue-turnstile';
import { defineElement } from '@vueform/vueform'
export default defineElement({
name: 'TurnstileElement',
nullValue: '',
props: {
siteKey: {
type: String,
required: false,
default: 'custom',
}
},
setup(props, { element }) {
},
components: {
VueTurnstile
},
})
</script>
<template>
<ElementLayout>
<template #element>
<vue-turnstile ref="input" :site-key="siteKey" v-model="value" />
</template>
<!-- Default element slots -->
<template v-for="(component, slot) in elementSlots" #[slot]>
<slot :name="slot" :el$="el$">
<component :is="component" :el$="el$" />
</slot>
</template>
</ElementLayout>
</template> The element value has the token (or nothing if human validation failed) which then has to be validated server-side as well at form submission. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Released in |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Implement captcha element
Beta Was this translation helpful? Give feedback.
All reactions