|
|
@@ -41,6 +41,17 @@
|
|
|
</v-col>
|
|
|
</v-row>
|
|
|
|
|
|
+ <v-row>
|
|
|
+ <v-col cols="12" class="captcha-container">
|
|
|
+ <AltchaValidation @verified="captchaVerified = true" />
|
|
|
+ <v-checkbox
|
|
|
+ v-model="honeyPotChecked"
|
|
|
+ :rules="[validateCaptcha]"
|
|
|
+ class="hidden-ctrl"
|
|
|
+ />
|
|
|
+ </v-col>
|
|
|
+ </v-row>
|
|
|
+
|
|
|
<!-- Submit Button -->
|
|
|
<div class="d-flex flex-row justify-center">
|
|
|
<v-btn
|
|
|
@@ -80,15 +91,24 @@ const contactRequestSent: Ref<boolean> = ref(false)
|
|
|
|
|
|
const errorMsg: Ref<string | null> = ref(null)
|
|
|
|
|
|
+const i18n = useI18n()
|
|
|
+
|
|
|
const email: Ref<string | null> = ref(null)
|
|
|
const name: Ref<string | null> = ref(null)
|
|
|
const message: Ref<string | null> = ref(null)
|
|
|
+const captchaVerified: Ref<boolean> = ref(false)
|
|
|
+
|
|
|
+// Honeypot checkbox (if checked: it's probably a bot)
|
|
|
+const honeyPotChecked: Ref<boolean> = ref(false)
|
|
|
|
|
|
const validateEmail = (email: string | null) =>
|
|
|
- (!!email && /.+@.+\..+/.test(email)) || "L'adresse e-mail doit être valide"
|
|
|
+ (!!email && /.+@.+\..+/.test(email)) || i18n.t("email_must_be_valid")
|
|
|
|
|
|
const validateNonEmptyMessage = (message: string | null) =>
|
|
|
- (!!message && message.length > 0) || 'Le message ne peut pas être vide'
|
|
|
+ (!!message && message.length > 10) || i18n.t("message_must_be_valid")
|
|
|
+
|
|
|
+const validateCaptcha = () =>
|
|
|
+ captchaVerified.value && !honeyPotChecked.value || i18n.t("captcha_must_be_validated")
|
|
|
|
|
|
/**
|
|
|
* Submits the contact form.
|
|
|
@@ -143,7 +163,24 @@ const submit = async (): Promise<void> => {
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
+.captcha-container {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ margin: 24px 0;
|
|
|
+
|
|
|
+ :deep(altcha-widget) {
|
|
|
+ min-width: 280px;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
.confirmation-message .v-card {
|
|
|
padding: 14px;
|
|
|
}
|
|
|
+
|
|
|
+.hidden-ctrl {
|
|
|
+ :deep(.v-input__control) {
|
|
|
+ display: none;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|