From 9303bd5d36181d4516a31a4521a05d5003337a47 Mon Sep 17 00:00:00 2001 From: Ekaterina Vaartis Date: Sat, 15 Dec 2018 03:05:47 +0300 Subject: [PATCH 1/6] Base support for CAPTCHA (kocaptcha) --- src/components/registration/registration.js | 12 +++++++++++- src/components/registration/registration.vue | 12 ++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/components/registration/registration.js b/src/components/registration/registration.js index e5ead8bc..c4e96b3c 100644 --- a/src/components/registration/registration.js +++ b/src/components/registration/registration.js @@ -11,7 +11,8 @@ const registration = { username: '', password: '', confirm: '' - } + }, + captcha: {} }), validations: { user: { @@ -29,6 +30,13 @@ const registration = { if ((!this.registrationOpen && !this.token) || this.signedIn) { this.$router.push('/main/all') } + + fetch("/api/pleroma/captcha") + .then(resp => resp.json()) + .then(resp => { + // TODO: check for errors + this.captcha = resp + }) }, computed: { token () { return this.$route.params.token }, @@ -45,6 +53,8 @@ const registration = { async submit () { this.user.nickname = this.user.username this.user.token = this.token + this.user.captcha_solution = this.captcha.solution; + this.user.captcha_token = this.captcha.token; this.$v.$touch() 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 @@ +
+ +
+
From 92de235f4e15f7cd69e150e07d5251305a3c251c Mon Sep 17 00:00:00 2001 From: Ekaterina Vaartis Date: Sat, 15 Dec 2018 03:06:21 +0300 Subject: [PATCH 2/6] Support disabling captcha --- src/components/registration/registration.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 @@
-
+