Add a way to get new captcha on click

This commit is contained in:
Ekaterina Vaartis 2018-12-16 22:47:52 +03:00
parent 3c9c8052f7
commit ab6f1904fa
2 changed files with 6 additions and 2 deletions

View file

@ -31,7 +31,7 @@ const registration = {
this.$router.push('/main/all') this.$router.push('/main/all')
} }
this.getCaptcha().then(cpt => { this.captcha = cpt }) this.setCaptcha()
}, },
computed: { computed: {
token () { return this.$route.params.token }, token () { return this.$route.params.token },
@ -61,6 +61,9 @@ const registration = {
console.warn('Registration failed: ' + error) console.warn('Registration failed: ' + error)
} }
} }
},
setCaptcha() {
this.getCaptcha().then(cpt => { this.captcha = cpt })
} }
} }
} }

View file

@ -77,8 +77,9 @@
<div class="form-group" id="captcha-group" v-if="captcha.type != 'none'"> <div class="form-group" id="captcha-group" v-if="captcha.type != 'none'">
<template v-if="captcha.type == 'kocaptcha'"> <template v-if="captcha.type == 'kocaptcha'">
<img v-bind:src="captcha.url"> <img v-bind:src="captcha.url" v-on:click="setCaptcha">
<sub>Click the image to get a new captcha</sub>
<label class='form--label' for='captcha-label'>CAPTCHA</label> <label class='form--label' for='captcha-label'>CAPTCHA</label>
<input :disabled="isPending" <input :disabled="isPending"