From 9303bd5d36181d4516a31a4521a05d5003337a47 Mon Sep 17 00:00:00 2001
From: Ekaterina Vaartis <vaartis@cock.li>
Date: Sat, 15 Dec 2018 03:05:47 +0300
Subject: Base support for CAPTCHA (kocaptcha)

---
 src/components/registration/registration.vue | 12 ++++++++++++
 1 file changed, 12 insertions(+)

(limited to 'src/components/registration/registration.vue')

diff --git a/src/components/registration/registration.vue b/src/components/registration/registration.vue
index 8cb1392b..d4fb1ad0 100644
--- a/src/components/registration/registration.vue
+++ b/src/components/registration/registration.vue
@@ -75,6 +75,18 @@
               </ul>
             </div>
 
+            <div class="form-group" id="captcha-group">
+              <template v-if="captcha.type == 'kocaptcha'">
+                <img v-bind:src="captcha.url">
+
+                <label class='form--label' for='captcha-label'>CAPTCHA</label>
+
+                <input :disabled="isPending"
+                  v-model='captcha.solution'
+                  class='form-control' id='captcha-answer' type='text'>
+              </template>
+            </div>
+
             <div class='form-group' v-if='token' >
               <label for='token'>{{$t('registration.token')}}</label>
               <input disabled='true' v-model='token' class='form-control' id='token' type='text'>
-- 
cgit v1.2.3-70-g09d2


From 92de235f4e15f7cd69e150e07d5251305a3c251c Mon Sep 17 00:00:00 2001
From: Ekaterina Vaartis <vaartis@cock.li>
Date: Sat, 15 Dec 2018 03:06:21 +0300
Subject: Support disabling captcha

---
 src/components/registration/registration.vue | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/components/registration/registration.vue')

diff --git a/src/components/registration/registration.vue b/src/components/registration/registration.vue
index d4fb1ad0..be0084dd 100644
--- a/src/components/registration/registration.vue
+++ b/src/components/registration/registration.vue
@@ -75,7 +75,7 @@
               </ul>
             </div>
 
-            <div class="form-group" id="captcha-group">
+            <div class="form-group" id="captcha-group" v-if="captcha.type != 'none'">
               <template v-if="captcha.type == 'kocaptcha'">
                 <img v-bind:src="captcha.url">
 
-- 
cgit v1.2.3-70-g09d2


From ab6f1904fae8fad7e4a5de89d6d613285283f28e Mon Sep 17 00:00:00 2001
From: Ekaterina Vaartis <vaartis@cock.li>
Date: Sun, 16 Dec 2018 22:47:52 +0300
Subject: Add a way to get new captcha on click

---
 src/components/registration/registration.js  | 5 ++++-
 src/components/registration/registration.vue | 3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

(limited to 'src/components/registration/registration.vue')

diff --git a/src/components/registration/registration.js b/src/components/registration/registration.js
index 0c65ac5d..6b79469c 100644
--- a/src/components/registration/registration.js
+++ b/src/components/registration/registration.js
@@ -31,7 +31,7 @@ const registration = {
       this.$router.push('/main/all')
     }
 
-    this.getCaptcha().then(cpt => { this.captcha = cpt })
+    this.setCaptcha()
   },
   computed: {
     token () { return this.$route.params.token },
@@ -61,6 +61,9 @@ const registration = {
           console.warn('Registration failed: ' + error)
         }
       }
+    },
+    setCaptcha() {
+      this.getCaptcha().then(cpt => { this.captcha = cpt })
     }
   }
 }
diff --git a/src/components/registration/registration.vue b/src/components/registration/registration.vue
index be0084dd..f187e215 100644
--- a/src/components/registration/registration.vue
+++ b/src/components/registration/registration.vue
@@ -77,8 +77,9 @@
 
             <div class="form-group" id="captcha-group" v-if="captcha.type != 'none'">
               <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>
 
                 <input :disabled="isPending"
-- 
cgit v1.2.3-70-g09d2

