#41 - Ajouter une sécurité sur la page nous contacter (#59)

Co-authored-by: dbroqua <contact@darkou.fr>
Reviewed-on: https://git.darkou.fr/dbroqua/MusicTopus/pulls/59
This commit is contained in:
Damien Broqua 2022-09-01 11:37:57 +02:00
parent 2da6afa06d
commit da08aa0222
4 changed files with 83 additions and 37 deletions

View file

@ -17,6 +17,14 @@
<textarea name="message" id="message" rows="6" required v-model="message" ></textarea>
</div>
<% if (config.mailMethod !== 'formspree' ) { %>
<img src="/api/v1/contact" alt="Captcha" />
<div class="field">
<label for="captcha">Captcha</label>
<input type="text" name="captcha" id="captcha" v-model="captcha" required />
</div>
<% } %>
<button type="submit" class="button is-primary" :disabled="loading">
<% if (config.mailMethod !== 'formspree' ) { %>
<i class="icon-spin animate-spin" v-if="loading"></i>
@ -34,6 +42,7 @@
email: '',
name: '',
message: '',
captcha: '',
loading: false,
}
},
@ -50,10 +59,11 @@
const {
email,
message,
name
name,
captcha,
} = this;
axios.post('/api/v1/contact', {email, name, message})
axios.post('/api/v1/contact', {email, name, message, captcha})
.then( () => {
showToastr("Message correctement envoyé", true);
})