From 2ffe8f532d1e52605f8c4cd3210dadb2e553d4cc Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Fri, 10 May 2024 15:24:38 +0530 Subject: [PATCH 01/29] by pass captcha --- lib/Controller/AccountController.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index 35a14372..c79b4627 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -255,7 +255,12 @@ class AccountController extends Controller { */ public function verifyCaptcha(string $captchaInput = '') : DataResponse { $response = new DataResponse(); - + $captchToken = getenv('BYPASS_CAPTCHA_TOKEN'); + if($captchInpue === $$captchToken){ + $response->setStatus(200); + return $response; + } + $captchaResult = (string) $this->session->get(CaptchaService::CAPTCHA_RESULT_KEY, ''); $response->setStatus(400); if ($captchaResult === $captchaInput) { -- GitLab From d6cab567643443debdb63ff90c6ec6f5664f794b Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Fri, 10 May 2024 15:50:37 +0530 Subject: [PATCH 02/29] fix lint --- lib/Controller/AccountController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index c79b4627..1e43096b 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -256,7 +256,7 @@ class AccountController extends Controller { public function verifyCaptcha(string $captchaInput = '') : DataResponse { $response = new DataResponse(); $captchToken = getenv('BYPASS_CAPTCHA_TOKEN'); - if($captchInpue === $$captchToken){ + if($captchInpue === $$captchToken) { $response->setStatus(200); return $response; } -- GitLab From 36cf0331d7018eb0f426103d36808a7778a095bc Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Fri, 10 May 2024 15:54:44 +0530 Subject: [PATCH 03/29] fix names --- lib/Controller/AccountController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index 1e43096b..61e1c26a 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -256,7 +256,7 @@ class AccountController extends Controller { public function verifyCaptcha(string $captchaInput = '') : DataResponse { $response = new DataResponse(); $captchToken = getenv('BYPASS_CAPTCHA_TOKEN'); - if($captchInpue === $$captchToken) { + if($captchInput === $captchToken) { $response->setStatus(200); return $response; } -- GitLab From d416dca32cb2061251d5d80dd5f01c8d24d7db9e Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Fri, 10 May 2024 16:16:23 +0530 Subject: [PATCH 04/29] variable name correction --- lib/Controller/AccountController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index 61e1c26a..28163dbd 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -255,8 +255,8 @@ class AccountController extends Controller { */ public function verifyCaptcha(string $captchaInput = '') : DataResponse { $response = new DataResponse(); - $captchToken = getenv('BYPASS_CAPTCHA_TOKEN'); - if($captchInput === $captchToken) { + $captchaToken = getenv('BYPASS_CAPTCHA_TOKEN'); + if($captchaInput === $captchaToken) { $response->setStatus(200); return $response; } -- GitLab From 9486a17de64e0fdef2c9dcf7d823c8bf4d5f72b4 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Fri, 10 May 2024 17:18:44 +0530 Subject: [PATCH 05/29] variable name correction --- lib/Controller/AccountController.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index 28163dbd..2e925470 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -257,7 +257,9 @@ class AccountController extends Controller { $response = new DataResponse(); $captchaToken = getenv('BYPASS_CAPTCHA_TOKEN'); if($captchaInput === $captchaToken) { + $this->session->set(self::CAPTCHA_VERIFIED_CHECK, true); $response->setStatus(200); + $this->session->remove(CaptchaService::CAPTCHA_RESULT_KEY); return $response; } -- GitLab From e55a39bb900ebc1aff6d8f4e7ea6b4c009f2ae13 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Fri, 10 May 2024 17:31:55 +0530 Subject: [PATCH 06/29] removed duplicate code --- lib/Controller/AccountController.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index 2e925470..1ae763fd 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -256,19 +256,15 @@ class AccountController extends Controller { public function verifyCaptcha(string $captchaInput = '') : DataResponse { $response = new DataResponse(); $captchaToken = getenv('BYPASS_CAPTCHA_TOKEN'); - if($captchaInput === $captchaToken) { - $this->session->set(self::CAPTCHA_VERIFIED_CHECK, true); - $response->setStatus(200); - $this->session->remove(CaptchaService::CAPTCHA_RESULT_KEY); - return $response; - } - $captchaResult = (string) $this->session->get(CaptchaService::CAPTCHA_RESULT_KEY, ''); + // Initialize the default status to 400 (Bad Request) $response->setStatus(400); - if ($captchaResult === $captchaInput) { + // Check if the input matches the bypass token or the stored captcha result + if ($captchaInput === $captchaToken || $captchaInput === $this->session->get(CaptchaService::CAPTCHA_RESULT_KEY, '')) { $this->session->set(self::CAPTCHA_VERIFIED_CHECK, true); $response->setStatus(200); } + $this->session->remove(CaptchaService::CAPTCHA_RESULT_KEY); return $response; } -- GitLab From e78d94ea99f09faa052dd5f723563f9b1b6d9666 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Fri, 10 May 2024 17:33:31 +0530 Subject: [PATCH 07/29] removed duplicate code --- lib/Controller/AccountController.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index 1ae763fd..6110d0c1 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -260,11 +260,12 @@ class AccountController extends Controller { // Initialize the default status to 400 (Bad Request) $response->setStatus(400); // Check if the input matches the bypass token or the stored captcha result - if ($captchaInput === $captchaToken || $captchaInput === $this->session->get(CaptchaService::CAPTCHA_RESULT_KEY, '')) { + $captchaResult = (string) $this->session->get(CaptchaService::CAPTCHA_RESULT_KEY, ''); + if ($captchaInput === $captchaToken || $captchaInput === $captchaResult) { $this->session->set(self::CAPTCHA_VERIFIED_CHECK, true); $response->setStatus(200); } - + $this->session->remove(CaptchaService::CAPTCHA_RESULT_KEY); return $response; } -- GitLab From 6f268b8a5287a97c824d555f18ac8268217404a1 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Mon, 13 May 2024 10:51:32 +0530 Subject: [PATCH 08/29] add in config --- lib/Controller/AccountController.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index 6110d0c1..21ea93de 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -255,8 +255,7 @@ class AccountController extends Controller { */ public function verifyCaptcha(string $captchaInput = '') : DataResponse { $response = new DataResponse(); - $captchaToken = getenv('BYPASS_CAPTCHA_TOKEN'); - + $captchaToken = $this->config->getSystemValue('BYPASS_CAPTCHA_TOKEN',''); // Initialize the default status to 400 (Bad Request) $response->setStatus(400); // Check if the input matches the bypass token or the stored captcha result -- GitLab From 8ed77183a5fea5dda77bf16b160dbaf2a94775f1 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Mon, 13 May 2024 10:53:18 +0530 Subject: [PATCH 09/29] add in config --- lib/Controller/AccountController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index 21ea93de..203aea1c 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -255,7 +255,7 @@ class AccountController extends Controller { */ public function verifyCaptcha(string $captchaInput = '') : DataResponse { $response = new DataResponse(); - $captchaToken = $this->config->getSystemValue('BYPASS_CAPTCHA_TOKEN',''); + $captchaToken = $this->config->getSystemValue('BYPASS_CAPTCHA_TOKEN', ''); // Initialize the default status to 400 (Bad Request) $response->setStatus(400); // Check if the input matches the bypass token or the stored captcha result -- GitLab From b8f9f19c5e4327c9150cdc8b8ed1f9dfde7f9968 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Mon, 13 May 2024 15:43:19 +0530 Subject: [PATCH 10/29] check empty --- lib/Controller/AccountController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index 203aea1c..bcf7612c 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -260,7 +260,7 @@ class AccountController extends Controller { $response->setStatus(400); // Check if the input matches the bypass token or the stored captcha result $captchaResult = (string) $this->session->get(CaptchaService::CAPTCHA_RESULT_KEY, ''); - if ($captchaInput === $captchaToken || $captchaInput === $captchaResult) { + if ((!empty($captchaToken) && $captchaInput === $captchaToken) || $captchaInput === $captchaResult) { $this->session->set(self::CAPTCHA_VERIFIED_CHECK, true); $response->setStatus(200); } -- GitLab From 51e5802a9d4bc0da24b661cf67aa7bff31dba369 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Mon, 13 May 2024 21:31:37 +0530 Subject: [PATCH 11/29] added parameter --- lib/Controller/AccountController.php | 4 ++-- src/signup/CaptchaForm.vue | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index bcf7612c..6bfeb636 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -253,14 +253,14 @@ class AccountController extends Controller { * * @return \OCP\AppFramework\Http\DataResponse */ - public function verifyCaptcha(string $captchaInput = '') : DataResponse { + public function verifyCaptcha(string $captchaInput = '',int $bypassToken = 0) : DataResponse { $response = new DataResponse(); $captchaToken = $this->config->getSystemValue('BYPASS_CAPTCHA_TOKEN', ''); // Initialize the default status to 400 (Bad Request) $response->setStatus(400); // Check if the input matches the bypass token or the stored captcha result $captchaResult = (string) $this->session->get(CaptchaService::CAPTCHA_RESULT_KEY, ''); - if ((!empty($captchaToken) && $captchaInput === $captchaToken) || $captchaInput === $captchaResult) { + if (($bypassToken === 1 && !empty($captchaToken) && $captchaInput === $captchaToken) || $captchaInput === $captchaResult) { $this->session->set(self::CAPTCHA_VERIFIED_CHECK, true); $response->setStatus(200); } diff --git a/src/signup/CaptchaForm.vue b/src/signup/CaptchaForm.vue index 2ad10720..ed77b6e1 100644 --- a/src/signup/CaptchaForm.vue +++ b/src/signup/CaptchaForm.vue @@ -68,6 +68,7 @@ export default { isCaptchaInputNotMatched: false, }, captchaImageUrl: generateUrl(`/apps/${APPLICATION_NAME}/accounts/captcha`), + bypassToken: null, } }, computed: { @@ -80,6 +81,9 @@ export default { }, }, }, + created() { + this.bypassToken = this.$route.query.bypassToken; + }, methods: { async checkAnswer() { this.validation.isCaptchaInputNotMatched = false -- GitLab From 572fe94633a1f6db7ceb93e01e1f0d17219b1495 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Mon, 13 May 2024 21:34:15 +0530 Subject: [PATCH 12/29] lint fix --- lib/Controller/AccountController.php | 2 +- src/signup/CaptchaForm.vue | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index 6bfeb636..fd3a767f 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -253,7 +253,7 @@ class AccountController extends Controller { * * @return \OCP\AppFramework\Http\DataResponse */ - public function verifyCaptcha(string $captchaInput = '',int $bypassToken = 0) : DataResponse { + public function verifyCaptcha(string $captchaInput = '', int $bypassToken = 0) : DataResponse { $response = new DataResponse(); $captchaToken = $this->config->getSystemValue('BYPASS_CAPTCHA_TOKEN', ''); // Initialize the default status to 400 (Bad Request) diff --git a/src/signup/CaptchaForm.vue b/src/signup/CaptchaForm.vue index ed77b6e1..5b91f47b 100644 --- a/src/signup/CaptchaForm.vue +++ b/src/signup/CaptchaForm.vue @@ -82,8 +82,8 @@ export default { }, }, created() { - this.bypassToken = this.$route.query.bypassToken; - }, + this.bypassToken = this.$route.query.bypassToken + }, methods: { async checkAnswer() { this.validation.isCaptchaInputNotMatched = false -- GitLab From cadba00f9442cda104e8aee08f2a116fb2b89ebd Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Mon, 13 May 2024 21:41:00 +0530 Subject: [PATCH 13/29] by pass token para --- src/signup/CaptchaForm.vue | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/signup/CaptchaForm.vue b/src/signup/CaptchaForm.vue index 5b91f47b..b7799865 100644 --- a/src/signup/CaptchaForm.vue +++ b/src/signup/CaptchaForm.vue @@ -92,6 +92,9 @@ export default { const data = { captchaInput: this.formData.captchaInput, } + if (this.bypassToken === 1) { + data.bypassToken = this.bypassToken + } const url = generateUrl(`/apps/${this.appName}/accounts/verify_captcha`) await Axios.post(url, data) const isFormValid = true -- GitLab From 815821fe34932f263952f026716d8de542a1f8ea Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Mon, 13 May 2024 21:49:17 +0530 Subject: [PATCH 14/29] by pass token para --- src/signup/CaptchaForm.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/signup/CaptchaForm.vue b/src/signup/CaptchaForm.vue index b7799865..aaf8de73 100644 --- a/src/signup/CaptchaForm.vue +++ b/src/signup/CaptchaForm.vue @@ -92,8 +92,12 @@ export default { const data = { captchaInput: this.formData.captchaInput, } + /* eslint-disable */ + console.log(this.bypassToken) if (this.bypassToken === 1) { + console.log("here") data.bypassToken = this.bypassToken + console.log("done") } const url = generateUrl(`/apps/${this.appName}/accounts/verify_captcha`) await Axios.post(url, data) -- GitLab From 120fe2a61a84888ea3fc44d70daca0f41ffa4c11 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Mon, 13 May 2024 22:51:59 +0530 Subject: [PATCH 15/29] vue route added --- css/ecloud-accounts-userregistration.css | 1 + package-lock.json | 13 ++++++++++++- package.json | 3 ++- 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 css/ecloud-accounts-userregistration.css diff --git a/css/ecloud-accounts-userregistration.css b/css/ecloud-accounts-userregistration.css new file mode 100644 index 00000000..f3b67749 --- /dev/null +++ b/css/ecloud-accounts-userregistration.css @@ -0,0 +1 @@ +html{background:var(--color-main-background)}#body-login .warning-messsage{width:100% !important}#body-login .v-align{align-items:flex-start !important;justify-content:flex-start !important}.v-align header{width:100% !important;display:flex !important;align-items:flex-start !important;justify-content:flex-start !important}#header{padding-left:5% !important}.v-align main{width:50% !important;margin:0 auto}#registrationForm .password-group #password{height:62px;margin-left:0;background-color:#fff;color:#000;border:1px solid #e6e8e9}@media only screen and (max-width: 768px){.v-align main{width:100% !important}#body-login .v-align{padding:2vh 0vh !important;max-height:fit-content !important}}#fields-password .Password__strength-meter{margin-bottom:0}#fields-password .Password__strength-meter:before{left:0}#fields-password .Password__strength-meter:after{right:0}#fields-password .Password__strength-meter:after,#fields-password .Password__strength-meter:before{width:100%} diff --git a/package-lock.json b/package-lock.json index 6a1bd3d6..41f41151 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,8 @@ "@nextcloud/router": "^2.0.0", "@nextcloud/vue": "^5.4.0", "vue": "^2.7.0", - "vue-password-strength-meter": "^1.7.2" + "vue-password-strength-meter": "^1.7.2", + "vue-router": "^3.6.5" }, "devDependencies": { "@nextcloud/babel-config": "^1.0.0", @@ -11161,6 +11162,11 @@ "vue": "^2.6.0" } }, + "node_modules/vue-router": { + "version": "3.6.5", + "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.6.5.tgz", + "integrity": "sha512-VYXZQLtjuvKxxcshuRAwjHnciqZVoXAjTjcqBTz4rKc8qih9g9pI3hbDjmqXaHdgL3v8pV6P8Z335XvHzESxLQ==" + }, "node_modules/vue-style-loader": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/vue-style-loader/-/vue-style-loader-4.1.3.tgz", @@ -20279,6 +20285,11 @@ "@babel/runtime": "^7.13.10" } }, + "vue-router": { + "version": "3.6.5", + "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.6.5.tgz", + "integrity": "sha512-VYXZQLtjuvKxxcshuRAwjHnciqZVoXAjTjcqBTz4rKc8qih9g9pI3hbDjmqXaHdgL3v8pV6P8Z335XvHzESxLQ==" + }, "vue-style-loader": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/vue-style-loader/-/vue-style-loader-4.1.3.tgz", diff --git a/package.json b/package.json index 30435c15..63cc7c03 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,8 @@ "@nextcloud/router": "^2.0.0", "@nextcloud/vue": "^5.4.0", "vue": "^2.7.0", - "vue-password-strength-meter": "^1.7.2" + "vue-password-strength-meter": "^1.7.2", + "vue-router": "^3.6.5" }, "browserslist": [ "extends @nextcloud/browserslist-config" -- GitLab From 2a4430e4d95390ec41513e465ddca5adfd632463 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Tue, 14 May 2024 13:31:01 +0530 Subject: [PATCH 16/29] added routes for parameter --- src/Signup.vue | 7 ++++++- src/routes.js | 20 ++++++++++++++++++++ src/signup.js | 2 ++ src/signup/CaptchaForm.vue | 11 +++++------ 4 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 src/routes.js diff --git a/src/Signup.vue b/src/Signup.vue index d6b2fc40..0fc46473 100644 --- a/src/Signup.vue +++ b/src/Signup.vue @@ -3,7 +3,10 @@
- +
@@ -49,6 +52,7 @@ export default { showCaptchaForm: false, showRecoveryEmailForm: false, showSuccessSection: false, + bypassToken: null, } }, mounted() { @@ -58,6 +62,7 @@ export default { // Set formData.email directly to recoveryEmail this.formData.email = recoveryEmail || '' + this.bypassToken = this.$route.query.bypassToken }, methods: { submitRegistrationForm(data) { diff --git a/src/routes.js b/src/routes.js new file mode 100644 index 00000000..7cca7407 --- /dev/null +++ b/src/routes.js @@ -0,0 +1,20 @@ +import Vue from 'vue' +import VueRouter from 'vue-router' +import Signup from './Signup.vue' + +Vue.use(VueRouter) + +const routes = [ + { + path: '/signup', + name: 'Signup', + component: () => Signup, + }, +] + +const router = new VueRouter({ + mode: 'history', + routes, +}) + +export default router diff --git a/src/signup.js b/src/signup.js index 591ad0f5..7a34fb8e 100644 --- a/src/signup.js +++ b/src/signup.js @@ -1,8 +1,10 @@ import Vue from 'vue' import './common.js' import Signup from './Signup.vue' +import router from './routes.js' export default new Vue({ el: '#ecloud-accounts-signup', + router, render: h => h(Signup), }) diff --git a/src/signup/CaptchaForm.vue b/src/signup/CaptchaForm.vue index aaf8de73..86e7a8ca 100644 --- a/src/signup/CaptchaForm.vue +++ b/src/signup/CaptchaForm.vue @@ -59,6 +59,10 @@ const APPLICATION_NAME = 'ecloud-accounts' export default { props: { value: Object, + bypassToken: { + type: String, + default: null, + }, }, data() { return { @@ -68,7 +72,6 @@ export default { isCaptchaInputNotMatched: false, }, captchaImageUrl: generateUrl(`/apps/${APPLICATION_NAME}/accounts/captcha`), - bypassToken: null, } }, computed: { @@ -81,9 +84,6 @@ export default { }, }, }, - created() { - this.bypassToken = this.$route.query.bypassToken - }, methods: { async checkAnswer() { this.validation.isCaptchaInputNotMatched = false @@ -95,9 +95,8 @@ export default { /* eslint-disable */ console.log(this.bypassToken) if (this.bypassToken === 1) { - console.log("here") + console.log() data.bypassToken = this.bypassToken - console.log("done") } const url = generateUrl(`/apps/${this.appName}/accounts/verify_captcha`) await Axios.post(url, data) -- GitLab From b286ca5cb0ba24dc895263f65900310a2ec1e6c8 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Tue, 14 May 2024 13:39:26 +0530 Subject: [PATCH 17/29] added console logs --- src/signup/CaptchaForm.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/signup/CaptchaForm.vue b/src/signup/CaptchaForm.vue index 86e7a8ca..35761937 100644 --- a/src/signup/CaptchaForm.vue +++ b/src/signup/CaptchaForm.vue @@ -94,8 +94,8 @@ export default { } /* eslint-disable */ console.log(this.bypassToken) - if (this.bypassToken === 1) { - console.log() + if (this.bypassToken === '1') { + console.log("by pass set") data.bypassToken = this.bypassToken } const url = generateUrl(`/apps/${this.appName}/accounts/verify_captcha`) -- GitLab From 93eb41c1382f8ba907cc8d075d108c268d4e6da8 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Tue, 14 May 2024 14:24:40 +0530 Subject: [PATCH 18/29] change the text into string --- lib/Controller/AccountController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index fd3a767f..3b4516b6 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -253,14 +253,14 @@ class AccountController extends Controller { * * @return \OCP\AppFramework\Http\DataResponse */ - public function verifyCaptcha(string $captchaInput = '', int $bypassToken = 0) : DataResponse { + public function verifyCaptcha(string $captchaInput = '', string $bypassToken = '') : DataResponse { $response = new DataResponse(); $captchaToken = $this->config->getSystemValue('BYPASS_CAPTCHA_TOKEN', ''); // Initialize the default status to 400 (Bad Request) $response->setStatus(400); // Check if the input matches the bypass token or the stored captcha result $captchaResult = (string) $this->session->get(CaptchaService::CAPTCHA_RESULT_KEY, ''); - if (($bypassToken === 1 && !empty($captchaToken) && $captchaInput === $captchaToken) || $captchaInput === $captchaResult) { + if (($bypassToken === "1" && !empty($captchaToken) && $captchaInput === $captchaToken) || $captchaInput === $captchaResult) { $this->session->set(self::CAPTCHA_VERIFIED_CHECK, true); $response->setStatus(200); } -- GitLab From 75239e019f03de5a75c86a7bb4df255425dc60f3 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Tue, 14 May 2024 14:32:38 +0530 Subject: [PATCH 19/29] removed console logs --- src/signup/CaptchaForm.vue | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/signup/CaptchaForm.vue b/src/signup/CaptchaForm.vue index 35761937..67d39396 100644 --- a/src/signup/CaptchaForm.vue +++ b/src/signup/CaptchaForm.vue @@ -92,12 +92,7 @@ export default { const data = { captchaInput: this.formData.captchaInput, } - /* eslint-disable */ - console.log(this.bypassToken) - if (this.bypassToken === '1') { - console.log("by pass set") - data.bypassToken = this.bypassToken - } + data.bypassToken = this.bypassToken const url = generateUrl(`/apps/${this.appName}/accounts/verify_captcha`) await Axios.post(url, data) const isFormValid = true -- GitLab From c31eec04c064120134060602aceb8f3b6950317d Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Tue, 14 May 2024 14:51:36 +0530 Subject: [PATCH 20/29] removed css --- css/ecloud-accounts-userregistration.css | 1 - 1 file changed, 1 deletion(-) delete mode 100644 css/ecloud-accounts-userregistration.css diff --git a/css/ecloud-accounts-userregistration.css b/css/ecloud-accounts-userregistration.css deleted file mode 100644 index f3b67749..00000000 --- a/css/ecloud-accounts-userregistration.css +++ /dev/null @@ -1 +0,0 @@ -html{background:var(--color-main-background)}#body-login .warning-messsage{width:100% !important}#body-login .v-align{align-items:flex-start !important;justify-content:flex-start !important}.v-align header{width:100% !important;display:flex !important;align-items:flex-start !important;justify-content:flex-start !important}#header{padding-left:5% !important}.v-align main{width:50% !important;margin:0 auto}#registrationForm .password-group #password{height:62px;margin-left:0;background-color:#fff;color:#000;border:1px solid #e6e8e9}@media only screen and (max-width: 768px){.v-align main{width:100% !important}#body-login .v-align{padding:2vh 0vh !important;max-height:fit-content !important}}#fields-password .Password__strength-meter{margin-bottom:0}#fields-password .Password__strength-meter:before{left:0}#fields-password .Password__strength-meter:after{right:0}#fields-password .Password__strength-meter:after,#fields-password .Password__strength-meter:before{width:100%} -- GitLab From 42457b096cd026cbaa18af53a4bae5c6df7d5ce5 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Tue, 14 May 2024 18:30:22 +0530 Subject: [PATCH 21/29] url to use token --- lib/Controller/AccountController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index 3b4516b6..957a0a48 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -260,7 +260,7 @@ class AccountController extends Controller { $response->setStatus(400); // Check if the input matches the bypass token or the stored captcha result $captchaResult = (string) $this->session->get(CaptchaService::CAPTCHA_RESULT_KEY, ''); - if (($bypassToken === "1" && !empty($captchaToken) && $captchaInput === $captchaToken) || $captchaInput === $captchaResult) { + if (($bypassToken === $captchaToken && !empty($captchaToken)) || $captchaInput === $captchaResult) { $this->session->set(self::CAPTCHA_VERIFIED_CHECK, true); $response->setStatus(200); } -- GitLab From bce9ba6117051775cfe0312705c343d8686e3668 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Tue, 14 May 2024 21:34:55 +0530 Subject: [PATCH 22/29] applied suggestions --- lib/Controller/AccountController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index 957a0a48..d8d90842 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -260,7 +260,7 @@ class AccountController extends Controller { $response->setStatus(400); // Check if the input matches the bypass token or the stored captcha result $captchaResult = (string) $this->session->get(CaptchaService::CAPTCHA_RESULT_KEY, ''); - if (($bypassToken === $captchaToken && !empty($captchaToken)) || $captchaInput === $captchaResult) { + if (($bypassToken === $captchaToken && !empty($captchaToken)) || (!empty($captchaResult) && $captchaInput === $captchaResult)) { $this->session->set(self::CAPTCHA_VERIFIED_CHECK, true); $response->setStatus(200); } -- GitLab From 270d0eaa97dc65a9fb696dc2eced6ea6732bd4da Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Tue, 14 May 2024 21:35:59 +0530 Subject: [PATCH 23/29] applied suggestions --- lib/Controller/AccountController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index d8d90842..a3281663 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -255,12 +255,12 @@ class AccountController extends Controller { */ public function verifyCaptcha(string $captchaInput = '', string $bypassToken = '') : DataResponse { $response = new DataResponse(); - $captchaToken = $this->config->getSystemValue('BYPASS_CAPTCHA_TOKEN', ''); + $captchaToken = $this->config->getSystemValue('bypass_captcha_token', ''); // Initialize the default status to 400 (Bad Request) $response->setStatus(400); // Check if the input matches the bypass token or the stored captcha result $captchaResult = (string) $this->session->get(CaptchaService::CAPTCHA_RESULT_KEY, ''); - if (($bypassToken === $captchaToken && !empty($captchaToken)) || (!empty($captchaResult) && $captchaInput === $captchaResult)) { + if ((!empty($captchaToken) && $bypassToken === $captchaToken) || (!empty($captchaResult) && $captchaInput === $captchaResult)) { $this->session->set(self::CAPTCHA_VERIFIED_CHECK, true); $response->setStatus(200); } -- GitLab From 3c8d78b8d36a292d8cdd89614b73ed91f2ce5f17 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Wed, 15 May 2024 20:46:22 +0530 Subject: [PATCH 24/29] directly use route in child component --- src/Signup.vue | 3 --- src/signup/CaptchaForm.vue | 9 ++++----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/Signup.vue b/src/Signup.vue index 0fc46473..82e3158c 100644 --- a/src/Signup.vue +++ b/src/Signup.vue @@ -5,7 +5,6 @@ @@ -52,7 +51,6 @@ export default { showCaptchaForm: false, showRecoveryEmailForm: false, showSuccessSection: false, - bypassToken: null, } }, mounted() { @@ -62,7 +60,6 @@ export default { // Set formData.email directly to recoveryEmail this.formData.email = recoveryEmail || '' - this.bypassToken = this.$route.query.bypassToken }, methods: { submitRegistrationForm(data) { diff --git a/src/signup/CaptchaForm.vue b/src/signup/CaptchaForm.vue index 67d39396..80dbab68 100644 --- a/src/signup/CaptchaForm.vue +++ b/src/signup/CaptchaForm.vue @@ -59,10 +59,6 @@ const APPLICATION_NAME = 'ecloud-accounts' export default { props: { value: Object, - bypassToken: { - type: String, - default: null, - }, }, data() { return { @@ -83,6 +79,9 @@ export default { this.$emit('input', formData) }, }, + bypassToken() { + return this.$route.query.bypassToken || null + }, }, methods: { async checkAnswer() { @@ -91,8 +90,8 @@ export default { try { const data = { captchaInput: this.formData.captchaInput, + bypassToken: this.bypassToken, } - data.bypassToken = this.bypassToken const url = generateUrl(`/apps/${this.appName}/accounts/verify_captcha`) await Axios.post(url, data) const isFormValid = true -- GitLab From 7fdc32c6e567121ce5d0a0ba405d9c5d23a82a6f Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Wed, 15 May 2024 21:20:37 +0530 Subject: [PATCH 25/29] removed computed --- src/signup/CaptchaForm.vue | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/signup/CaptchaForm.vue b/src/signup/CaptchaForm.vue index 80dbab68..0798be3e 100644 --- a/src/signup/CaptchaForm.vue +++ b/src/signup/CaptchaForm.vue @@ -79,9 +79,6 @@ export default { this.$emit('input', formData) }, }, - bypassToken() { - return this.$route.query.bypassToken || null - }, }, methods: { async checkAnswer() { @@ -90,7 +87,7 @@ export default { try { const data = { captchaInput: this.formData.captchaInput, - bypassToken: this.bypassToken, + bypassToken: this.$route.query.bypassToken || null, } const url = generateUrl(`/apps/${this.appName}/accounts/verify_captcha`) await Axios.post(url, data) -- GitLab From cd45a66514412d41854b49e44a132fe6bc7199e7 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Thu, 16 May 2024 09:53:48 +0530 Subject: [PATCH 26/29] check bypassToken value with console log --- src/signup/CaptchaForm.vue | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/signup/CaptchaForm.vue b/src/signup/CaptchaForm.vue index 0798be3e..70524303 100644 --- a/src/signup/CaptchaForm.vue +++ b/src/signup/CaptchaForm.vue @@ -89,6 +89,11 @@ export default { captchaInput: this.formData.captchaInput, bypassToken: this.$route.query.bypassToken || null, } + const urlParams = new URLSearchParams(window.location.search); + const myParam = urlParams.get('bypassToken'); + /* eslint-disable no-console */ + console.log("here is the value of bypassToken") + console.log(myParam) const url = generateUrl(`/apps/${this.appName}/accounts/verify_captcha`) await Axios.post(url, data) const isFormValid = true -- GitLab From 798deda09d41bc6d6432e3a53054081ea3f9053c Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Thu, 16 May 2024 09:54:08 +0530 Subject: [PATCH 27/29] check bypassToken value with console log --- src/signup/CaptchaForm.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/signup/CaptchaForm.vue b/src/signup/CaptchaForm.vue index 70524303..87b62f84 100644 --- a/src/signup/CaptchaForm.vue +++ b/src/signup/CaptchaForm.vue @@ -89,8 +89,8 @@ export default { captchaInput: this.formData.captchaInput, bypassToken: this.$route.query.bypassToken || null, } - const urlParams = new URLSearchParams(window.location.search); - const myParam = urlParams.get('bypassToken'); + const urlParams = new URLSearchParams(window.location.search) + const myParam = urlParams.get('bypassToken') /* eslint-disable no-console */ console.log("here is the value of bypassToken") console.log(myParam) -- GitLab From 14bba444e455e37a2e9a99fd13afea0213d6471e Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Thu, 16 May 2024 09:58:32 +0530 Subject: [PATCH 28/29] check bypassToken value with console log --- src/signup/CaptchaForm.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/signup/CaptchaForm.vue b/src/signup/CaptchaForm.vue index 87b62f84..3028dbbf 100644 --- a/src/signup/CaptchaForm.vue +++ b/src/signup/CaptchaForm.vue @@ -92,7 +92,7 @@ export default { const urlParams = new URLSearchParams(window.location.search) const myParam = urlParams.get('bypassToken') /* eslint-disable no-console */ - console.log("here is the value of bypassToken") + console.log('here is the value of bypassToken') console.log(myParam) const url = generateUrl(`/apps/${this.appName}/accounts/verify_captcha`) await Axios.post(url, data) -- GitLab From 083e7006e6925707b5b4e71ea22a6899d4c2b465 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Thu, 16 May 2024 10:07:04 +0530 Subject: [PATCH 29/29] removed route --- package-lock.json | 13 +------------ package.json | 3 +-- src/routes.js | 20 -------------------- src/signup.js | 2 -- src/signup/CaptchaForm.vue | 9 +++------ 5 files changed, 5 insertions(+), 42 deletions(-) delete mode 100644 src/routes.js diff --git a/package-lock.json b/package-lock.json index 41f41151..6a1bd3d6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,8 +15,7 @@ "@nextcloud/router": "^2.0.0", "@nextcloud/vue": "^5.4.0", "vue": "^2.7.0", - "vue-password-strength-meter": "^1.7.2", - "vue-router": "^3.6.5" + "vue-password-strength-meter": "^1.7.2" }, "devDependencies": { "@nextcloud/babel-config": "^1.0.0", @@ -11162,11 +11161,6 @@ "vue": "^2.6.0" } }, - "node_modules/vue-router": { - "version": "3.6.5", - "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.6.5.tgz", - "integrity": "sha512-VYXZQLtjuvKxxcshuRAwjHnciqZVoXAjTjcqBTz4rKc8qih9g9pI3hbDjmqXaHdgL3v8pV6P8Z335XvHzESxLQ==" - }, "node_modules/vue-style-loader": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/vue-style-loader/-/vue-style-loader-4.1.3.tgz", @@ -20285,11 +20279,6 @@ "@babel/runtime": "^7.13.10" } }, - "vue-router": { - "version": "3.6.5", - "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.6.5.tgz", - "integrity": "sha512-VYXZQLtjuvKxxcshuRAwjHnciqZVoXAjTjcqBTz4rKc8qih9g9pI3hbDjmqXaHdgL3v8pV6P8Z335XvHzESxLQ==" - }, "vue-style-loader": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/vue-style-loader/-/vue-style-loader-4.1.3.tgz", diff --git a/package.json b/package.json index 63cc7c03..30435c15 100644 --- a/package.json +++ b/package.json @@ -25,8 +25,7 @@ "@nextcloud/router": "^2.0.0", "@nextcloud/vue": "^5.4.0", "vue": "^2.7.0", - "vue-password-strength-meter": "^1.7.2", - "vue-router": "^3.6.5" + "vue-password-strength-meter": "^1.7.2" }, "browserslist": [ "extends @nextcloud/browserslist-config" diff --git a/src/routes.js b/src/routes.js deleted file mode 100644 index 7cca7407..00000000 --- a/src/routes.js +++ /dev/null @@ -1,20 +0,0 @@ -import Vue from 'vue' -import VueRouter from 'vue-router' -import Signup from './Signup.vue' - -Vue.use(VueRouter) - -const routes = [ - { - path: '/signup', - name: 'Signup', - component: () => Signup, - }, -] - -const router = new VueRouter({ - mode: 'history', - routes, -}) - -export default router diff --git a/src/signup.js b/src/signup.js index 7a34fb8e..591ad0f5 100644 --- a/src/signup.js +++ b/src/signup.js @@ -1,10 +1,8 @@ import Vue from 'vue' import './common.js' import Signup from './Signup.vue' -import router from './routes.js' export default new Vue({ el: '#ecloud-accounts-signup', - router, render: h => h(Signup), }) diff --git a/src/signup/CaptchaForm.vue b/src/signup/CaptchaForm.vue index 3028dbbf..5085b8d8 100644 --- a/src/signup/CaptchaForm.vue +++ b/src/signup/CaptchaForm.vue @@ -85,15 +85,12 @@ export default { this.validation.isCaptchaInputNotMatched = false try { + const urlParams = new URLSearchParams(window.location.search) + const bypassToken = urlParams.get('bypassToken') const data = { captchaInput: this.formData.captchaInput, - bypassToken: this.$route.query.bypassToken || null, + bypassToken: bypassToken || null, } - const urlParams = new URLSearchParams(window.location.search) - const myParam = urlParams.get('bypassToken') - /* eslint-disable no-console */ - console.log('here is the value of bypassToken') - console.log(myParam) const url = generateUrl(`/apps/${this.appName}/accounts/verify_captcha`) await Axios.post(url, data) const isFormValid = true -- GitLab