From 30cbed9fc6b975983dd11a731805410df0407856 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 6 Feb 2024 23:51:27 -0800 Subject: [PATCH 01/13] added recovery email as param --- css/ecloud-accounts-userregistration.css | 1 + lib/Controller/AccountController.php | 9 ++++++--- 2 files changed, 7 insertions(+), 3 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..2c62b4f6 --- /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:var(--input-background-color);color:var(--color-main-text);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} diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index be3e8ada..1c0996dd 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -71,19 +71,22 @@ class AccountController extends Controller { * @NoCSRFRequired * * @param string $lang Language code (default: 'en') + * @param string $recoveryEmail recoveryemail (default: '') * */ - public function index(string $lang = 'en') { + public function index(string $lang = 'en', string $recoveryEmail = '') { if ($this->userSession->isLoggedIn()) { return new RedirectResponse($this->urlGenerator->linkToDefaultPageUrl()); } $_SERVER['HTTP_ACCEPT_LANGUAGE'] = $lang; - + if($recoveryEmail != ''){ + print_r($recoveryEmail); die; + } return new TemplateResponse( Application::APP_ID, 'signup', - ['appName' => Application::APP_ID, 'lang' => $lang], + ['appName' => Application::APP_ID, 'lang' => $lang, 'recoveryEmail' => $recoveryEmail], TemplateResponse::RENDER_AS_GUEST ); } -- GitLab From b15d78cbbf4cfe256f418525ab993ce044ea38a1 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 6 Feb 2024 23:52:09 -0800 Subject: [PATCH 02/13] added recovery email as param --- 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 2c62b4f6..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:var(--input-background-color);color:var(--color-main-text);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} -- GitLab From 12a3d74331d8f3e65bb0b09defdd3ea6f4067c28 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Wed, 7 Feb 2024 00:05:42 -0800 Subject: [PATCH 03/13] added recovery email as param --- lib/Controller/AccountController.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index 1c0996dd..746e77cc 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -74,14 +74,16 @@ class AccountController extends Controller { * @param string $recoveryEmail recoveryemail (default: '') * */ - public function index(string $lang = 'en', string $recoveryEmail = '') { + public function index(string $lang = 'en', string $recoveryEmail = '') + { if ($this->userSession->isLoggedIn()) { return new RedirectResponse($this->urlGenerator->linkToDefaultPageUrl()); } $_SERVER['HTTP_ACCEPT_LANGUAGE'] = $lang; - if($recoveryEmail != ''){ - print_r($recoveryEmail); die; + if ($recoveryEmail != '') { + print_r($recoveryEmail); + die; } return new TemplateResponse( Application::APP_ID, -- GitLab From 9dff0536dd3ce4f49464f2d5ccd8e106448b49f4 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Wed, 7 Feb 2024 00:07:19 -0800 Subject: [PATCH 04/13] php fix --- 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 746e77cc..5f1d8e4a 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -74,8 +74,7 @@ class AccountController extends Controller { * @param string $recoveryEmail recoveryemail (default: '') * */ - public function index(string $lang = 'en', string $recoveryEmail = '') - { + public function index(string $lang = 'en', string $recoveryEmail = '') { if ($this->userSession->isLoggedIn()) { return new RedirectResponse($this->urlGenerator->linkToDefaultPageUrl()); } -- GitLab From 1578f3e22fb1d186a957a208a6de95f4d901c825 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Wed, 7 Feb 2024 00:10:10 -0800 Subject: [PATCH 05/13] php fix --- lib/Controller/AccountController.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index 5f1d8e4a..d617ccbb 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -80,10 +80,7 @@ class AccountController extends Controller { } $_SERVER['HTTP_ACCEPT_LANGUAGE'] = $lang; - if ($recoveryEmail != '') { - print_r($recoveryEmail); - die; - } + return new TemplateResponse( Application::APP_ID, 'signup', -- GitLab From 55ed30cdb34af2254ab20e97780974ff5d6e6e67 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Wed, 7 Feb 2024 00:19:31 -0800 Subject: [PATCH 06/13] changes --- src/Signup.vue | 13 +++++++++++++ src/signup.js | 9 ++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/Signup.vue b/src/Signup.vue index 8be5e5cf..0b4e4d8f 100644 --- a/src/Signup.vue +++ b/src/Signup.vue @@ -2,6 +2,13 @@
+

+ Recovery Email: {{ recoveryEmail }} +

+

+ No recovery email provided. +

+ @@ -30,6 +37,12 @@ export default { RecoveryEmailForm, SuccessSection, }, + props: { + recoveryEmail: { + type: String, + default: '', + }, + }, data() { return { formData: { diff --git a/src/signup.js b/src/signup.js index 591ad0f5..c6116d82 100644 --- a/src/signup.js +++ b/src/signup.js @@ -2,7 +2,14 @@ import Vue from 'vue' import './common.js' import Signup from './Signup.vue' +const urlParams = new URLSearchParams(window.location.search) +const recoveryEmail = urlParams.get('recoveryEmail') ?? '' + export default new Vue({ el: '#ecloud-accounts-signup', - render: h => h(Signup), + render: h => h(Signup, { + props: { + recoveryEmail, + }, + }), }) -- GitLab From 297ae6139b6ce5a595b6c11bf23080aaa3250f82 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Wed, 7 Feb 2024 00:29:05 -0800 Subject: [PATCH 07/13] reverted --- lib/Controller/AccountController.php | 7 +++---- src/Signup.vue | 22 +++++++++------------- src/signup.js | 9 +-------- 3 files changed, 13 insertions(+), 25 deletions(-) diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index d617ccbb..be3e8ada 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -71,20 +71,19 @@ class AccountController extends Controller { * @NoCSRFRequired * * @param string $lang Language code (default: 'en') - * @param string $recoveryEmail recoveryemail (default: '') * */ - public function index(string $lang = 'en', string $recoveryEmail = '') { + public function index(string $lang = 'en') { if ($this->userSession->isLoggedIn()) { return new RedirectResponse($this->urlGenerator->linkToDefaultPageUrl()); } $_SERVER['HTTP_ACCEPT_LANGUAGE'] = $lang; - + return new TemplateResponse( Application::APP_ID, 'signup', - ['appName' => Application::APP_ID, 'lang' => $lang, 'recoveryEmail' => $recoveryEmail], + ['appName' => Application::APP_ID, 'lang' => $lang], TemplateResponse::RENDER_AS_GUEST ); } diff --git a/src/Signup.vue b/src/Signup.vue index 0b4e4d8f..972167ef 100644 --- a/src/Signup.vue +++ b/src/Signup.vue @@ -2,13 +2,6 @@
-

- Recovery Email: {{ recoveryEmail }} -

-

- No recovery email provided. -

- @@ -37,12 +30,6 @@ export default { RecoveryEmailForm, SuccessSection, }, - props: { - recoveryEmail: { - type: String, - default: '', - }, - }, data() { return { formData: { @@ -62,8 +49,17 @@ export default { showCaptchaForm: false, showRecoveryEmailForm: false, showSuccessSection: false, + recoveryEmail: '', } }, + mounted() { + // Extracting the recovery email from the URL when the component is mounted + const urlParams = new URLSearchParams(window.location.search) + this.recoveryEmail = urlParams.get('recoveryEmail') + + // Set formData.email directly to recoveryEmail + this.formData.email = this.recoveryEmail + }, methods: { submitRegistrationForm(data) { if (data.isFormValid) { diff --git a/src/signup.js b/src/signup.js index c6116d82..591ad0f5 100644 --- a/src/signup.js +++ b/src/signup.js @@ -2,14 +2,7 @@ import Vue from 'vue' import './common.js' import Signup from './Signup.vue' -const urlParams = new URLSearchParams(window.location.search) -const recoveryEmail = urlParams.get('recoveryEmail') ?? '' - export default new Vue({ el: '#ecloud-accounts-signup', - render: h => h(Signup, { - props: { - recoveryEmail, - }, - }), + render: h => h(Signup), }) -- GitLab From cce6fbba77dfd7eb4605faa0b50434ac13d71d9e Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 13 Feb 2024 22:02:02 -0800 Subject: [PATCH 08/13] added null conditio --- src/Signup.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Signup.vue b/src/Signup.vue index 972167ef..8cf346c3 100644 --- a/src/Signup.vue +++ b/src/Signup.vue @@ -56,7 +56,9 @@ export default { // Extracting the recovery email from the URL when the component is mounted const urlParams = new URLSearchParams(window.location.search) this.recoveryEmail = urlParams.get('recoveryEmail') - + if (!this.recoveryEmail) { + this.recoveryEmail = '' + } // Set formData.email directly to recoveryEmail this.formData.email = this.recoveryEmail }, -- GitLab From ad1e106c15969db45d861ed425c5f47529dfc825 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 13 Feb 2024 22:04:15 -0800 Subject: [PATCH 09/13] added null conditio --- src/Signup.vue | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Signup.vue b/src/Signup.vue index 8cf346c3..58173a11 100644 --- a/src/Signup.vue +++ b/src/Signup.vue @@ -48,19 +48,16 @@ export default { showRegistrationForm: true, showCaptchaForm: false, showRecoveryEmailForm: false, - showSuccessSection: false, - recoveryEmail: '', + showSuccessSection: false } }, mounted() { // Extracting the recovery email from the URL when the component is mounted const urlParams = new URLSearchParams(window.location.search) - this.recoveryEmail = urlParams.get('recoveryEmail') - if (!this.recoveryEmail) { - this.recoveryEmail = '' - } + const recoveryEmail = urlParams.get('recoveryEmail') + // Set formData.email directly to recoveryEmail - this.formData.email = this.recoveryEmail + this.formData.email = recoveryEmail ? recoveryEmail : '' }, methods: { submitRegistrationForm(data) { -- GitLab From 603c4c8ffe5b313d63a4e98a9e528b513113a041 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 13 Feb 2024 22:06:03 -0800 Subject: [PATCH 10/13] added null conditio --- src/Signup.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Signup.vue b/src/Signup.vue index 58173a11..4fa39636 100644 --- a/src/Signup.vue +++ b/src/Signup.vue @@ -48,16 +48,16 @@ export default { showRegistrationForm: true, showCaptchaForm: false, showRecoveryEmailForm: false, - showSuccessSection: false + showSuccessSection: false, } }, mounted() { // Extracting the recovery email from the URL when the component is mounted const urlParams = new URLSearchParams(window.location.search) const recoveryEmail = urlParams.get('recoveryEmail') - + // Set formData.email directly to recoveryEmail - this.formData.email = recoveryEmail ? recoveryEmail : '' + this.formData.email = recoveryEmail || '' }, methods: { submitRegistrationForm(data) { -- GitLab From 22d607e13271e5118ddbbc7ec93a380924a4f07f Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 13 Feb 2024 22:22:22 -0800 Subject: [PATCH 11/13] unverfied recovery email condition added --- lib/Service/UserService.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/Service/UserService.php b/lib/Service/UserService.php index d8995194..c4c187ac 100644 --- a/lib/Service/UserService.php +++ b/lib/Service/UserService.php @@ -306,6 +306,10 @@ class UserService { if(count($users)) { return true; } + $users = $this->config->getUsersForUserValue('email-recovery', 'unverified-recovery-email', $recoveryEmail); + if(count($users)) { + return true; + } return false; } -- GitLab From 2abd04621aeac368e1121a8353fae19bf833d6cb Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 13 Feb 2024 22:26:03 -0800 Subject: [PATCH 12/13] unverfied recovery email condition added --- lib/Controller/AccountController.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index be3e8ada..66a5bc86 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -154,20 +154,19 @@ class AccountController extends Controller { $response->setStatus(200); $response->setData(['success' => true]); + + $this->session->remove(self::SESSION_USERNAME_CHECK); + $this->session->remove(self::CAPTCHA_VERIFIED_CHECK); + try { + $this->userService->addUsernameToCommonDataStore($username); + } catch (Exception $e) { + $this->logger->logException($e, ['app' => Application::APP_ID]); + } } catch (Exception $e) { $response->setData(['message' => $e->getMessage(), 'success' => false]); $response->setStatus(500); } - - $this->session->remove(self::SESSION_USERNAME_CHECK); - $this->session->remove(self::CAPTCHA_VERIFIED_CHECK); - - try { - $this->userService->addUsernameToCommonDataStore($username); - } catch (Exception $e) { - $this->logger->logException($e, ['app' => Application::APP_ID]); - } return $response; } /** -- GitLab From 42504546cef107d23429d1277cd62d236d5b5a4c Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 13 Feb 2024 22:26:50 -0800 Subject: [PATCH 13/13] unverfied recovery email condition added --- lib/Controller/AccountController.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index 66a5bc86..00aa714a 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -152,9 +152,6 @@ class AccountController extends Controller { $this->userService->sendWelcomeEmail($displayname, $username, $userEmail, $language); - $response->setStatus(200); - $response->setData(['success' => true]); - $this->session->remove(self::SESSION_USERNAME_CHECK); $this->session->remove(self::CAPTCHA_VERIFIED_CHECK); @@ -163,10 +160,15 @@ class AccountController extends Controller { } catch (Exception $e) { $this->logger->logException($e, ['app' => Application::APP_ID]); } + + $response->setStatus(200); + $response->setData(['success' => true]); + } catch (Exception $e) { $response->setData(['message' => $e->getMessage(), 'success' => false]); $response->setStatus(500); } + return $response; } /** -- GitLab