ldespe
ldespe
CDCloudflare Developers
Created by ldespe on 9/4/2024 in #general-help
Problem Recaptcha NuxtJs/Turnstile
My problem is i don't know if serve key is a test key or if it's my site key which is a test key
12 replies
CDCloudflare Developers
Created by ldespe on 9/4/2024 in #general-help
Problem Recaptcha NuxtJs/Turnstile
I want that the message "test only" disappear and be sur that my two keys are valid
12 replies
CDCloudflare Developers
Created by ldespe on 9/4/2024 in #general-help
Problem Recaptcha NuxtJs/Turnstile
I have an impression that my key is replace in my code for a test key but where ?
12 replies
CDCloudflare Developers
Created by ldespe on 9/4/2024 in #general-help
Problem Recaptcha NuxtJs/Turnstile
However, the two keys I use come from my widget
12 replies
CDCloudflare Developers
Created by ldespe on 9/4/2024 in #general-help
Problem Recaptcha NuxtJs/Turnstile
s
<script lang="ts">
import { useRuntimeConfig } from '#app';
export default{
name :"Footer",
data(){
const turnstile = ref()
return{
input1:"Nom",
input2:"Email",
numero:"+33 7 66 66 78 67",
turnstile
}
},
setup() {
const config = useRuntimeConfig();
return {
config
};

},


methods:{
async sendEmail() {
const form = this.$refs.form as HTMLFormElement;
try {
await this.$emailjs.sendForm(
this.config.public.emailjsServiceId,
this.config.public.emailjsTemplateId,
form,
this.config.public.emailjsPublicKey,
);
}
catch (error) {
console.log('FAILED...', error);
}
},
async sendF() {
const token = this.turnstile; // Assurez-vous que turnstile a une méthode pour obtenir le token
if (!token) {
console.error('Token not available');
this.reset();
return;
}

try {
const response = await fetch('/api/validateTurnstile', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ token }), // Envoyez le token correctement
});if (response.ok) {
const result = await response.json();
console.log(response)
await this.sendEmail();
console.log("Success")
} else {
const result = await response.json();
console.error(result)
console.error('Validation failed:', result);
this.reset();
} } catch (error) { console.error('Request failed:', error);
this.reset();
}
},
reset(){
this.turnstile.value?.reset()
}
},
<script lang="ts">
import { useRuntimeConfig } from '#app';
export default{
name :"Footer",
data(){
const turnstile = ref()
return{
input1:"Nom",
input2:"Email",
numero:"+33 7 66 66 78 67",
turnstile
}
},
setup() {
const config = useRuntimeConfig();
return {
config
};

},


methods:{
async sendEmail() {
const form = this.$refs.form as HTMLFormElement;
try {
await this.$emailjs.sendForm(
this.config.public.emailjsServiceId,
this.config.public.emailjsTemplateId,
form,
this.config.public.emailjsPublicKey,
);
}
catch (error) {
console.log('FAILED...', error);
}
},
async sendF() {
const token = this.turnstile; // Assurez-vous que turnstile a une méthode pour obtenir le token
if (!token) {
console.error('Token not available');
this.reset();
return;
}

try {
const response = await fetch('/api/validateTurnstile', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ token }), // Envoyez le token correctement
});if (response.ok) {
const result = await response.json();
console.log(response)
await this.sendEmail();
console.log("Success")
} else {
const result = await response.json();
console.error(result)
console.error('Validation failed:', result);
this.reset();
} } catch (error) { console.error('Request failed:', error);
this.reset();
}
},
reset(){
this.turnstile.value?.reset()
}
},
12 replies
CDCloudflare Developers
Created by ldespe on 9/4/2024 in #general-help
Problem Recaptcha NuxtJs/Turnstile
Pourtant les deux clés que j'utilise viennent de mon widget
form class="footer--email" ref="form" @submit.prevent="sendF" method="POST">
<h3>Pour me contacter</h3>
<div class="container--email">
<div class="email--nom--mail">
<InputsSimple :text="input1" type="text" name="from_name"/>
<InputsSimple :text="input2" type="text" name="email_id"/>
</div>
<textarea id="message" name="message" placeholder="Ecrivez votre message"></textarea>
</div>
<NuxtTurnstile ref="turnstile" v-model="turnstile" />
<button id="send">Envoyer</button>
</form>

<p id="by">Made By ldesperrois</p>
</footer>
</template>
form class="footer--email" ref="form" @submit.prevent="sendF" method="POST">
<h3>Pour me contacter</h3>
<div class="container--email">
<div class="email--nom--mail">
<InputsSimple :text="input1" type="text" name="from_name"/>
<InputsSimple :text="input2" type="text" name="email_id"/>
</div>
<textarea id="message" name="message" placeholder="Ecrivez votre message"></textarea>
</div>
<NuxtTurnstile ref="turnstile" v-model="turnstile" />
<button id="send">Envoyer</button>
</form>

<p id="by">Made By ldesperrois</p>
</footer>
</template>
12 replies
CDCloudflare Developers
Created by ldespe on 9/4/2024 in #general-help
Problem Recaptcha NuxtJs/Turnstile
Why replace the sitekey ? sorry for me it's difficult to understand the implicit because i speak french
12 replies
CDCloudflare Developers
Created by ldespe on 9/4/2024 in #general-help
Problem Recaptcha NuxtJs/Turnstile
No description
12 replies
CDCloudflare Developers
Created by ldespe on 9/4/2024 in #general-help
Problem Recaptcha NuxtJs/Turnstile
For the moment, i develop the website in local
12 replies