From c5af3da2693d3e553efd00875911d61701b0ff3d Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Wed, 28 Feb 2024 23:27:05 -0800 Subject: [PATCH 01/37] user cannot use @e.email or @murena.io address as recovery email --- appinfo/info.xml | 2 +- lib/Service/UserService.php | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/appinfo/info.xml b/appinfo/info.xml index a4d9725f..0d326733 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -10,7 +10,7 @@ - 4.0.0 + 4.0.1 agpl Murena SAS EcloudAccounts diff --git a/lib/Service/UserService.php b/lib/Service/UserService.php index c4c187ac..f0c01e9d 100644 --- a/lib/Service/UserService.php +++ b/lib/Service/UserService.php @@ -246,6 +246,9 @@ class UserService { if (!empty($recoveryEmail) && $this->checkRecoveryEmailAvailable($recoveryEmail)) { throw new Exception("Recovery email address is already taken."); } + if (!empty($recoveryEmail) && !$this->checkValidDomain($recoveryEmail)) { + throw new Exception("Recovery email address cannot have domains like @e.email or @murena.io"); + } return $this->addNewUserToLDAP($displayname, $recoveryEmail, $username, $userEmail, $password); } @@ -313,6 +316,29 @@ class UserService { return false; } + /** + * Check if a recovery email address is available (not already taken by another user). + * + * @param string $recoveryEmail The recovery email address to check. + * + * @return bool True if the recovery email address is available, false otherwise. + */ + public function checkValidDomain(string $recoveryEmail): bool { + $recoveryEmail = strtolower($recoveryEmail); + $notAllowedDomains = ['e.email', 'murena.io']; + + // Extract domain from the recovery email + $emailParts = explode('@', $recoveryEmail); + if (count($emailParts) !== 2) { + return false; // Invalid email format + } + $domain = $emailParts[1]; + + // Check if the domain is in the allowed domains list + return !in_array($domain, $notAllowedDomains); + } + + /** * Create a Hide My Email (HME) alias for a user. * -- GitLab From 39ccd3e8d7454ba2efda1c0fae7491ec04968372 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Wed, 28 Feb 2024 23:44:46 -0800 Subject: [PATCH 02/37] added invalid --- lib/Service/UserService.php | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/lib/Service/UserService.php b/lib/Service/UserService.php index f0c01e9d..ee74e2e4 100644 --- a/lib/Service/UserService.php +++ b/lib/Service/UserService.php @@ -39,6 +39,7 @@ class UserService { /** @var LDAPConnectionService */ private $LDAPConnectionService; + public const NOT_ALLOWED_DOMAINS = ['e.email', 'murena.io']; public function __construct($appName, IUserManager $userManager, IConfig $config, CurlService $curlService, ILogger $logger, Defaults $defaults, IFactory $l10nFactory, LDAPConnectionService $LDAPConnectionService) { $this->userManager = $userManager; $this->config = $config; @@ -243,10 +244,13 @@ class UserService { if ($this->userExists($username)) { throw new Exception("Username is already taken."); } + if (!empty($recoveryEmail) && !$this->isValidEmailFormat($recoveryEmail)) { + throw new Exception("Recovery email address is in invalid format."); + } if (!empty($recoveryEmail) && $this->checkRecoveryEmailAvailable($recoveryEmail)) { throw new Exception("Recovery email address is already taken."); } - if (!empty($recoveryEmail) && !$this->checkValidDomain($recoveryEmail)) { + if (!empty($recoveryEmail) && !$this->isRecoveryEmailDomainDisallowed($recoveryEmail)) { throw new Exception("Recovery email address cannot have domains like @e.email or @murena.io"); } return $this->addNewUserToLDAP($displayname, $recoveryEmail, $username, $userEmail, $password); @@ -317,27 +321,34 @@ class UserService { } /** - * Check if a recovery email address is available (not already taken by another user). + * Check if a recovery email address domain is allowed * * @param string $recoveryEmail The recovery email address to check. * - * @return bool True if the recovery email address is available, false otherwise. + * @return bool True if the recovery email address is valid, false otherwise. */ - public function checkValidDomain(string $recoveryEmail): bool { + public function isRecoveryEmailDomainDisallowed(string $recoveryEmail): bool { $recoveryEmail = strtolower($recoveryEmail); - $notAllowedDomains = ['e.email', 'murena.io']; - // Extract domain from the recovery email $emailParts = explode('@', $recoveryEmail); if (count($emailParts) !== 2) { return false; // Invalid email format } $domain = $emailParts[1]; - // Check if the domain is in the allowed domains list - return !in_array($domain, $notAllowedDomains); + return !in_array($domain, self::NOT_ALLOWED_DOMAINS); + } + + /** + * Check if a recovery email address is in valid format + * + * @param string $recoveryEmail The recovery email address to check. + * + * @return bool True if the recovery email address is valid, false otherwise. + */ + public function isValidEmailFormat(string $recoveryEmail): bool { + return filter_var($recoveryEmail, FILTER_VALIDATE_EMAIL) !== false; } - /** * Create a Hide My Email (HME) alias for a user. -- GitLab From 34fdfba1de1c7b3d0c787775581e2bb93ccaa710 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Wed, 28 Feb 2024 23:45:56 -0800 Subject: [PATCH 03/37] added invalid --- lib/Service/UserService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Service/UserService.php b/lib/Service/UserService.php index ee74e2e4..c4bced3d 100644 --- a/lib/Service/UserService.php +++ b/lib/Service/UserService.php @@ -245,7 +245,7 @@ class UserService { throw new Exception("Username is already taken."); } if (!empty($recoveryEmail) && !$this->isValidEmailFormat($recoveryEmail)) { - throw new Exception("Recovery email address is in invalid format."); + throw new Exception("The recovery email address has an incorrect format."); } if (!empty($recoveryEmail) && $this->checkRecoveryEmailAvailable($recoveryEmail)) { throw new Exception("Recovery email address is already taken."); -- GitLab From 861e2a2e30bf7b53c8a1b435570fb472debc6eff Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Wed, 28 Feb 2024 23:46:28 -0800 Subject: [PATCH 04/37] added invalid --- lib/Service/UserService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Service/UserService.php b/lib/Service/UserService.php index c4bced3d..3fcb4ab4 100644 --- a/lib/Service/UserService.php +++ b/lib/Service/UserService.php @@ -245,7 +245,7 @@ class UserService { throw new Exception("Username is already taken."); } if (!empty($recoveryEmail) && !$this->isValidEmailFormat($recoveryEmail)) { - throw new Exception("The recovery email address has an incorrect format."); + throw new Exception("Recovery email address has an incorrect format."); } if (!empty($recoveryEmail) && $this->checkRecoveryEmailAvailable($recoveryEmail)) { throw new Exception("Recovery email address is already taken."); -- GitLab From 692426fa044d92b792e9bb1866ddea635d97bed4 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Wed, 28 Feb 2024 23:49:40 -0800 Subject: [PATCH 05/37] added invalid --- lib/Service/UserService.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/Service/UserService.php b/lib/Service/UserService.php index 3fcb4ab4..85464766 100644 --- a/lib/Service/UserService.php +++ b/lib/Service/UserService.php @@ -331,10 +331,7 @@ class UserService { $recoveryEmail = strtolower($recoveryEmail); $emailParts = explode('@', $recoveryEmail); - if (count($emailParts) !== 2) { - return false; // Invalid email format - } - $domain = $emailParts[1]; + $domain = $emailParts[1] ?? ''; return !in_array($domain, self::NOT_ALLOWED_DOMAINS); } -- GitLab From b1cc6ee721d2b025a1249c0daf1837197214435f Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Wed, 28 Feb 2024 23:52:49 -0800 Subject: [PATCH 06/37] changed comments --- lib/Service/UserService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Service/UserService.php b/lib/Service/UserService.php index 85464766..082dc85d 100644 --- a/lib/Service/UserService.php +++ b/lib/Service/UserService.php @@ -321,7 +321,7 @@ class UserService { } /** - * Check if a recovery email address domain is allowed + * Check if a recovery email address domain is restricted for some domains * * @param string $recoveryEmail The recovery email address to check. * -- GitLab From 7e66d6165bdd6bb602a00144bc04384cd50d0daf Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Thu, 29 Feb 2024 00:24:54 -0800 Subject: [PATCH 07/37] temporaily captcha remove --- 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 00aa714a..60669cc0 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -152,8 +152,8 @@ class AccountController extends Controller { $this->userService->sendWelcomeEmail($displayname, $username, $userEmail, $language); - $this->session->remove(self::SESSION_USERNAME_CHECK); - $this->session->remove(self::CAPTCHA_VERIFIED_CHECK); + // $this->session->remove(self::SESSION_USERNAME_CHECK); + // $this->session->remove(self::CAPTCHA_VERIFIED_CHECK); try { $this->userService->addUsernameToCommonDataStore($username); -- GitLab From 5dfdb1d2db14b8d9de34a971155ab177ac25e6d1 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Thu, 29 Feb 2024 00:52:34 -0800 Subject: [PATCH 08/37] changed to confif --- lib/Service/UserService.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/Service/UserService.php b/lib/Service/UserService.php index 082dc85d..926a4ef6 100644 --- a/lib/Service/UserService.php +++ b/lib/Service/UserService.php @@ -39,7 +39,6 @@ class UserService { /** @var LDAPConnectionService */ private $LDAPConnectionService; - public const NOT_ALLOWED_DOMAINS = ['e.email', 'murena.io']; public function __construct($appName, IUserManager $userManager, IConfig $config, CurlService $curlService, ILogger $logger, Defaults $defaults, IFactory $l10nFactory, LDAPConnectionService $LDAPConnectionService) { $this->userManager = $userManager; $this->config = $config; @@ -328,12 +327,16 @@ class UserService { * @return bool True if the recovery email address is valid, false otherwise. */ public function isRecoveryEmailDomainDisallowed(string $recoveryEmail): bool { + $legacyDomain = $this->config->getSystemValue('legacy_domain', ''); + $mainDomain = $this->config->getSystemValue('main_domain', ''); + + $notAllowedDomains = [$legacyDomain, $mainDomain]; $recoveryEmail = strtolower($recoveryEmail); $emailParts = explode('@', $recoveryEmail); $domain = $emailParts[1] ?? ''; - return !in_array($domain, self::NOT_ALLOWED_DOMAINS); + return !in_array($domain, $notAllowedDomains); } /** -- GitLab From 1c451000139abcf81dc5547c482495edc03eccc8 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Thu, 29 Feb 2024 00:54:52 -0800 Subject: [PATCH 09/37] changed to confif --- 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 60669cc0..00aa714a 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -152,8 +152,8 @@ class AccountController extends Controller { $this->userService->sendWelcomeEmail($displayname, $username, $userEmail, $language); - // $this->session->remove(self::SESSION_USERNAME_CHECK); - // $this->session->remove(self::CAPTCHA_VERIFIED_CHECK); + $this->session->remove(self::SESSION_USERNAME_CHECK); + $this->session->remove(self::CAPTCHA_VERIFIED_CHECK); try { $this->userService->addUsernameToCommonDataStore($username); -- GitLab From d8654ef6da6b339b9eda6ba53a0340edf8cec27b Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Thu, 29 Feb 2024 01:09:20 -0800 Subject: [PATCH 10/37] changed to murena domains --- lib/Service/UserService.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/Service/UserService.php b/lib/Service/UserService.php index 926a4ef6..403f6fb2 100644 --- a/lib/Service/UserService.php +++ b/lib/Service/UserService.php @@ -38,6 +38,7 @@ class UserService { private $apiConfig; /** @var LDAPConnectionService */ private $LDAPConnectionService; + private $notAllowedDomains; public function __construct($appName, IUserManager $userManager, IConfig $config, CurlService $curlService, ILogger $logger, Defaults $defaults, IFactory $l10nFactory, LDAPConnectionService $LDAPConnectionService) { $this->userManager = $userManager; @@ -63,6 +64,10 @@ class UserService { 'userCluserId' => $this->config->getSystemValue('user_cluser_id', ''), 'objectClass' => $this->config->getSystemValue('ldap_object_class', []), ]; + + $legacyDomain = $this->config->getSystemValue('legacy_domain', ''); + $mainDomain = $this->config->getSystemValue('main_domain', ''); + $this->notAllowedDomains = [ $legacyDomain, $mainDomain ]; } @@ -250,7 +255,7 @@ class UserService { throw new Exception("Recovery email address is already taken."); } if (!empty($recoveryEmail) && !$this->isRecoveryEmailDomainDisallowed($recoveryEmail)) { - throw new Exception("Recovery email address cannot have domains like @e.email or @murena.io"); + throw new Exception("Recovery email address cannot have murena domains."); } return $this->addNewUserToLDAP($displayname, $recoveryEmail, $username, $userEmail, $password); @@ -327,16 +332,13 @@ class UserService { * @return bool True if the recovery email address is valid, false otherwise. */ public function isRecoveryEmailDomainDisallowed(string $recoveryEmail): bool { - $legacyDomain = $this->config->getSystemValue('legacy_domain', ''); - $mainDomain = $this->config->getSystemValue('main_domain', ''); - - $notAllowedDomains = [$legacyDomain, $mainDomain]; + $recoveryEmail = strtolower($recoveryEmail); $emailParts = explode('@', $recoveryEmail); $domain = $emailParts[1] ?? ''; - return !in_array($domain, $notAllowedDomains); + return !in_array($domain, $this->notAllowedDomains); } /** -- GitLab From 0832085362c32a704b3fa44ba4ab1d56f77e125d Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Thu, 29 Feb 2024 01:26:53 -0800 Subject: [PATCH 11/37] change the var name --- lib/Service/UserService.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Service/UserService.php b/lib/Service/UserService.php index 403f6fb2..965eec69 100644 --- a/lib/Service/UserService.php +++ b/lib/Service/UserService.php @@ -38,7 +38,7 @@ class UserService { private $apiConfig; /** @var LDAPConnectionService */ private $LDAPConnectionService; - private $notAllowedDomains; + private $restrictedDomains; public function __construct($appName, IUserManager $userManager, IConfig $config, CurlService $curlService, ILogger $logger, Defaults $defaults, IFactory $l10nFactory, LDAPConnectionService $LDAPConnectionService) { $this->userManager = $userManager; @@ -67,7 +67,7 @@ class UserService { $legacyDomain = $this->config->getSystemValue('legacy_domain', ''); $mainDomain = $this->config->getSystemValue('main_domain', ''); - $this->notAllowedDomains = [ $legacyDomain, $mainDomain ]; + $this->restrictedDomains = [ $legacyDomain, $mainDomain ]; } @@ -338,7 +338,7 @@ class UserService { $emailParts = explode('@', $recoveryEmail); $domain = $emailParts[1] ?? ''; - return !in_array($domain, $this->notAllowedDomains); + return !in_array($domain, $this->restrictedDomains); } /** -- GitLab From e40e099cdc72a92bccc3506a08e2a1ca7452d6de Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Thu, 29 Feb 2024 10:58:03 -0800 Subject: [PATCH 12/37] added config --- lib/Service/UserService.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/Service/UserService.php b/lib/Service/UserService.php index 965eec69..5c7ab42b 100644 --- a/lib/Service/UserService.php +++ b/lib/Service/UserService.php @@ -38,7 +38,6 @@ class UserService { private $apiConfig; /** @var LDAPConnectionService */ private $LDAPConnectionService; - private $restrictedDomains; public function __construct($appName, IUserManager $userManager, IConfig $config, CurlService $curlService, ILogger $logger, Defaults $defaults, IFactory $l10nFactory, LDAPConnectionService $LDAPConnectionService) { $this->userManager = $userManager; @@ -65,9 +64,6 @@ class UserService { 'objectClass' => $this->config->getSystemValue('ldap_object_class', []), ]; - $legacyDomain = $this->config->getSystemValue('legacy_domain', ''); - $mainDomain = $this->config->getSystemValue('main_domain', ''); - $this->restrictedDomains = [ $legacyDomain, $mainDomain ]; } @@ -337,8 +333,12 @@ class UserService { $emailParts = explode('@', $recoveryEmail); $domain = $emailParts[1] ?? ''; - - return !in_array($domain, $this->restrictedDomains); + + $legacyDomain = $this->config->getSystemValue('legacy_domain', ''); + $mainDomain = $this->config->getSystemValue('main_domain', ''); + $restrictedDomains = [ $legacyDomain, $mainDomain ]; + + return !in_array($domain, $restrictedDomains); } /** -- GitLab From 1b26edd1e361e67c8e476aadef401c800d821f6e Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Thu, 29 Feb 2024 11:06:33 -0800 Subject: [PATCH 13/37] change in domain function --- lib/Service/UserService.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/Service/UserService.php b/lib/Service/UserService.php index 5c7ab42b..8fdbb1a8 100644 --- a/lib/Service/UserService.php +++ b/lib/Service/UserService.php @@ -63,7 +63,6 @@ class UserService { 'userCluserId' => $this->config->getSystemValue('user_cluser_id', ''), 'objectClass' => $this->config->getSystemValue('ldap_object_class', []), ]; - } @@ -201,6 +200,9 @@ class UserService { public function getMainDomain() : string { return $this->config->getSystemValue('main_domain', ''); } + public function getLegacyDomain() : string { + return $this->config->getSystemValue('legacy_domain', ''); + } public function setUserLanguage(string $username, string $language = 'en') { $this->config->setUserValue($username, 'core', 'lang', $language); } @@ -334,8 +336,9 @@ class UserService { $emailParts = explode('@', $recoveryEmail); $domain = $emailParts[1] ?? ''; - $legacyDomain = $this->config->getSystemValue('legacy_domain', ''); - $mainDomain = $this->config->getSystemValue('main_domain', ''); + $legacyDomain = $this->getLegacyDomain(); + $mainDomain = $this->getMainDomain(); + $restrictedDomains = [ $legacyDomain, $mainDomain ]; return !in_array($domain, $restrictedDomains); -- GitLab From 02e49f2c5bb6ed6707155a53526b905884a453b8 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Thu, 29 Feb 2024 21:30:24 -0800 Subject: [PATCH 14/37] added translations --- l10n/de.js | 5 ++++- l10n/de.json | 5 ++++- l10n/en.js | 5 ++++- l10n/en.json | 5 ++++- l10n/es.js | 5 ++++- l10n/es.json | 5 ++++- l10n/fr.js | 5 ++++- l10n/fr.json | 5 ++++- l10n/it.js | 5 ++++- l10n/it.json | 5 ++++- lib/Service/UserService.php | 14 +++++++++----- 11 files changed, 49 insertions(+), 15 deletions(-) diff --git a/l10n/de.js b/l10n/de.js index d12d723b..72866f2b 100644 --- a/l10n/de.js +++ b/l10n/de.js @@ -78,6 +78,9 @@ OC.L10N.register( "Use an alternative email": "Verwenden Sie eine alternative E-Mail", "Important:": "Das ist wichtig:", "For security reasons, a recovery email is required. If you decide to set it later, your account will be partially restricted.": "Aus Sicherheitsgründen ist eine Wiederherstellungs-E-Mail erforderlich. Wenn Sie sich entscheiden, diese später einzustellen, wird Ihr Konto teilweise eingeschränkt.", - "Set a recovery email address": "Festlegen einer Wiederherstellungs-E-Mail-Adresse" + "Set a recovery email address": "Festlegen einer Wiederherstellungs-E-Mail-Adresse", + "Recovery email address has an incorrect format.": "Die E-Mail-Adresse für die Wiederherstellung hat ein falsches Format.", + "Recovery email address is already taken.": "Die E-Mail-Adresse für die Wiederherstellung ist bereits vergeben.", + "Recovery email address cannot have murena domains.": "Wiederherstellungs-E-Mail-Adressen können keine Murena-Domänen haben." }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/de.json b/l10n/de.json index 1acdb33c..00018be8 100644 --- a/l10n/de.json +++ b/l10n/de.json @@ -76,7 +76,10 @@ "Use an alternative email": "Verwenden Sie eine alternative E-Mail", "Important:": "Das ist wichtig:", "For security reasons, a recovery email is required. If you decide to set it later, your account will be partially restricted.": "Aus Sicherheitsgründen ist eine Wiederherstellungs-E-Mail erforderlich. Wenn Sie sich entscheiden, diese später einzustellen, wird Ihr Konto teilweise eingeschränkt.", - "Set a recovery email address": "Festlegen einer Wiederherstellungs-E-Mail-Adresse" + "Set a recovery email address": "Festlegen einer Wiederherstellungs-E-Mail-Adresse", + "Recovery email address has an incorrect format.": "Die E-Mail-Adresse für die Wiederherstellung hat ein falsches Format.", + "Recovery email address is already taken.": "Die E-Mail-Adresse für die Wiederherstellung ist bereits vergeben.", + "Recovery email address cannot have murena domains.": "Wiederherstellungs-E-Mail-Adressen können keine Murena-Domänen haben." }, "pluralForm": "nplurals=2; plural=(n != 1);" } diff --git a/l10n/en.js b/l10n/en.js index cf71a745..b93239b3 100644 --- a/l10n/en.js +++ b/l10n/en.js @@ -82,6 +82,9 @@ OC.L10N.register( "Use an alternative email": "Use an alternative email", "Important:": "Important:", "For security reasons, a recovery email is required. If you decide to set it later, your account will be partially restricted.": "For security reasons, a recovery email is required. If you decide to set it later, your account will be partially restricted.", - "Set a recovery email address": "Set a recovery email address" + "Set a recovery email address": "Set a recovery email address", + "Recovery email address has an incorrect format.": "Recovery email address has an incorrect format.", + "Recovery email address is already taken.": "Recovery email address is already taken.", + "Recovery email address cannot have murena domains.": "Recovery email address cannot have murena domains." }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/en.json b/l10n/en.json index 51a28a35..948fd5a6 100644 --- a/l10n/en.json +++ b/l10n/en.json @@ -78,7 +78,10 @@ "Use an alternative email": "Use an alternative email", "Important:": "Important:", "For security reasons, a recovery email is required. If you decide to set it later, your account will be partially restricted.": "For security reasons, a recovery email is required. If you decide to set it later, your account will be partially restricted.", - "Set a recovery email address": "Set a recovery email address" + "Set a recovery email address": "Set a recovery email address", + "Recovery email address has an incorrect format.": "Recovery email address has an incorrect format.", + "Recovery email address is already taken.": "Recovery email address is already taken.", + "Recovery email address cannot have murena domains.": "Recovery email address cannot have murena domains." }, "pluralForm": "nplurals=2; plural=(n != 1);" } diff --git a/l10n/es.js b/l10n/es.js index a6cf885b..3f78aac2 100644 --- a/l10n/es.js +++ b/l10n/es.js @@ -80,6 +80,9 @@ OC.L10N.register( "Use an alternative email": "Utilizar un correo electrónico alternativo", "Important:": "Importante:", "For security reasons, a recovery email is required. If you decide to set it later, your account will be partially restricted.": "Por razones de seguridad, se requiere un correo electrónico de recuperación. Si decides configurarlo más tarde, tu cuenta quedará parcialmente restringida.", - "Set a recovery email address": "Establecer una dirección de correo electrónico de recuperación" + "Set a recovery email address": "Establecer una dirección de correo electrónico de recuperación", + "Recovery email address has an incorrect format.": "La dirección de correo electrónico de recuperación tiene un formato incorrecto.", + "Recovery email address is already taken.": "La dirección de correo electrónico de recuperación ya está ocupada.", + "Recovery email address cannot have murena domains.": "La dirección de correo electrónico de recuperación no puede tener dominios murena." }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/es.json b/l10n/es.json index 45441c31..337eaf2b 100644 --- a/l10n/es.json +++ b/l10n/es.json @@ -79,7 +79,10 @@ "Use an alternative email": "Utilizar un correo electrónico alternativo", "Important:": "Importante:", "For security reasons, a recovery email is required. If you decide to set it later, your account will be partially restricted.": "Por razones de seguridad, se requiere un correo electrónico de recuperación. Si decides configurarlo más tarde, tu cuenta quedará parcialmente restringida.", - "Set a recovery email address": "Establecer una dirección de correo electrónico de recuperación" + "Set a recovery email address": "Establecer una dirección de correo electrónico de recuperación", + "Recovery email address has an incorrect format.": "La dirección de correo electrónico de recuperación tiene un formato incorrecto.", + "Recovery email address is already taken.": "La dirección de correo electrónico de recuperación ya está ocupada.", + "Recovery email address cannot have murena domains.": "La dirección de correo electrónico de recuperación no puede tener dominios murena." }, "pluralForm": "nplurals=2; plural=(n != 1);" } diff --git a/l10n/fr.js b/l10n/fr.js index 02a080b2..b3c14833 100644 --- a/l10n/fr.js +++ b/l10n/fr.js @@ -79,6 +79,9 @@ OC.L10N.register( "Use an alternative email": "Utiliser un autre courriel", "Important:": "Important :", "For security reasons, a recovery email is required. If you decide to set it later, your account will be partially restricted.": "Pour des raisons de sécurité, un courriel de récupération est nécessaire. Si vous décidez de le désactiver ultérieurement, votre compte sera partiellement restreint.", - "Set a recovery email address": "Définir une adresse électronique de récupération" + "Set a recovery email address": "Définir une adresse électronique de récupération", + "Recovery email address has an incorrect format.": "L'adresse électronique de récupération ne peut pas avoir de domaines murena.", + "Recovery email address is already taken.": "L'adresse électronique de récupération est déjà prise.", + "Recovery email address cannot have murena domains.": "L'adresse électronique de récupération ne peut pas avoir de domaines murena." }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/fr.json b/l10n/fr.json index 83a3ff78..176569fe 100644 --- a/l10n/fr.json +++ b/l10n/fr.json @@ -78,7 +78,10 @@ "Use an alternative email": "Utiliser un autre courriel", "Important:": "Important :", "For security reasons, a recovery email is required. If you decide to set it later, your account will be partially restricted.": "Pour des raisons de sécurité, un courriel de récupération est nécessaire. Si vous décidez de le désactiver ultérieurement, votre compte sera partiellement restreint.", - "Set a recovery email address": "Définir une adresse électronique de récupération" + "Set a recovery email address": "Définir une adresse électronique de récupération", + "Recovery email address has an incorrect format.": "L'adresse électronique de récupération ne peut pas avoir de domaines murena.", + "Recovery email address is already taken.": "L'adresse électronique de récupération est déjà prise.", + "Recovery email address cannot have murena domains.": "L'adresse électronique de récupération ne peut pas avoir de domaines murena." }, "pluralForm": "nplurals=2; plural=(n != 1);" } diff --git a/l10n/it.js b/l10n/it.js index 356b1284..47971a36 100644 --- a/l10n/it.js +++ b/l10n/it.js @@ -79,6 +79,9 @@ OC.L10N.register( "Use an alternative email": "Utilizzare un'e-mail alternativa", "Important:": "Importante:", "For security reasons, a recovery email is required. If you decide to set it later, your account will be partially restricted.": "Per motivi di sicurezza, è necessaria un'e-mail di recupero. Se si decide di impostarla in un secondo momento, l'account verrà parzialmente limitato.", - "Set a recovery email address": "Impostare un indirizzo e-mail di recupero" + "Set a recovery email address": "Impostare un indirizzo e-mail di recupero", + "Recovery email address has an incorrect format.": "L'indirizzo e-mail di recupero ha un formato errato.", + "Recovery email address is already taken.": "L'indirizzo e-mail di recupero è già stato preso.", + "Recovery email address cannot have murena domains.": "L'indirizzo e-mail di recupero non può avere domini murena." }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/it.json b/l10n/it.json index 7c62999b..8554fef5 100644 --- a/l10n/it.json +++ b/l10n/it.json @@ -74,7 +74,10 @@ "Use an alternative email": "Utilizzare un'e-mail alternativa", "Important:": "Importante:", "For security reasons, a recovery email is required. If you decide to set it later, your account will be partially restricted.": "Per motivi di sicurezza, è necessaria un'e-mail di recupero. Se si decide di impostarla in un secondo momento, l'account verrà parzialmente limitato.", - "Set a recovery email address": "Impostare un indirizzo e-mail di recupero" + "Set a recovery email address": "Impostare un indirizzo e-mail di recupero", + "Recovery email address has an incorrect format.": "L'indirizzo e-mail di recupero ha un formato errato.", + "Recovery email address is already taken.": "L'indirizzo e-mail di recupero è già stato preso.", + "Recovery email address cannot have murena domains.": "L'indirizzo e-mail di recupero non può avere domini murena." }, "pluralForm": "nplurals=2; plural=(n != 1);" } diff --git a/lib/Service/UserService.php b/lib/Service/UserService.php index 8fdbb1a8..2b8247e4 100644 --- a/lib/Service/UserService.php +++ b/lib/Service/UserService.php @@ -10,6 +10,7 @@ use Exception; use OCA\EcloudAccounts\AppInfo\Application; use OCP\Defaults; use OCP\IConfig; +use OCP\IL10N; use OCP\ILogger; use OCP\IUser; use OCP\IUserManager; @@ -38,8 +39,10 @@ class UserService { private $apiConfig; /** @var LDAPConnectionService */ private $LDAPConnectionService; + /** @var IL10N */ + protected $l10n; - public function __construct($appName, IUserManager $userManager, IConfig $config, CurlService $curlService, ILogger $logger, Defaults $defaults, IFactory $l10nFactory, LDAPConnectionService $LDAPConnectionService) { + public function __construct($appName, IUserManager $userManager, IConfig $config, CurlService $curlService, ILogger $logger, Defaults $defaults, IFactory $l10nFactory, LDAPConnectionService $LDAPConnectionService, IL10N $l10n) { $this->userManager = $userManager; $this->config = $config; $this->appConfig = $this->config->getSystemValue($appName); @@ -48,6 +51,7 @@ class UserService { $this->defaults = $defaults; $this->l10nFactory = $l10nFactory; $this->LDAPConnectionService = $LDAPConnectionService; + $this->l10n = $l10n; $commonServiceURL = $this->config->getSystemValue('common_services_url', ''); if (!empty($commonServiceURL)) { @@ -244,16 +248,16 @@ class UserService { public function registerUser(string $displayname, string $recoveryEmail, string $username, string $userEmail, string $password): array { if ($this->userExists($username)) { - throw new Exception("Username is already taken."); + throw new Exception($this->l10n->t('Username is already taken.')); } if (!empty($recoveryEmail) && !$this->isValidEmailFormat($recoveryEmail)) { - throw new Exception("Recovery email address has an incorrect format."); + throw new Exception($this->l10n->t('Recovery email address has an incorrect format.')); } if (!empty($recoveryEmail) && $this->checkRecoveryEmailAvailable($recoveryEmail)) { - throw new Exception("Recovery email address is already taken."); + throw new Exception($this->l10n->t('Recovery email address is already taken.')); } if (!empty($recoveryEmail) && !$this->isRecoveryEmailDomainDisallowed($recoveryEmail)) { - throw new Exception("Recovery email address cannot have murena domains."); + throw new Exception($this->l10n->t('Recovery email address cannot have murena domains.')); } return $this->addNewUserToLDAP($displayname, $recoveryEmail, $username, $userEmail, $password); -- GitLab From 182696a6e34a53139ca5d9bc15ad0cf5a753d540 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Fri, 1 Mar 2024 00:30:20 -0800 Subject: [PATCH 15/37] change in translations --- lib/Service/UserService.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/Service/UserService.php b/lib/Service/UserService.php index 2b8247e4..a9b31be9 100644 --- a/lib/Service/UserService.php +++ b/lib/Service/UserService.php @@ -10,7 +10,6 @@ use Exception; use OCA\EcloudAccounts\AppInfo\Application; use OCP\Defaults; use OCP\IConfig; -use OCP\IL10N; use OCP\ILogger; use OCP\IUser; use OCP\IUserManager; @@ -39,10 +38,9 @@ class UserService { private $apiConfig; /** @var LDAPConnectionService */ private $LDAPConnectionService; - /** @var IL10N */ - protected $l10n; + private $l10n; - public function __construct($appName, IUserManager $userManager, IConfig $config, CurlService $curlService, ILogger $logger, Defaults $defaults, IFactory $l10nFactory, LDAPConnectionService $LDAPConnectionService, IL10N $l10n) { + public function __construct($appName, IUserManager $userManager, IConfig $config, CurlService $curlService, ILogger $logger, Defaults $defaults, IFactory $l10nFactory, LDAPConnectionService $LDAPConnectionService) { $this->userManager = $userManager; $this->config = $config; $this->appConfig = $this->config->getSystemValue($appName); @@ -51,7 +49,7 @@ class UserService { $this->defaults = $defaults; $this->l10nFactory = $l10nFactory; $this->LDAPConnectionService = $LDAPConnectionService; - $this->l10n = $l10n; + $this->l10n = $this->l10nFactory->get("ecloud-accounts"); $commonServiceURL = $this->config->getSystemValue('common_services_url', ''); if (!empty($commonServiceURL)) { -- GitLab From 2eef99b6dcd22c227845a678e2bb953f7a2aa15a Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Fri, 1 Mar 2024 00:36:15 -0800 Subject: [PATCH 16/37] change in translations --- lib/Service/UserService.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/Service/UserService.php b/lib/Service/UserService.php index a9b31be9..7a443b70 100644 --- a/lib/Service/UserService.php +++ b/lib/Service/UserService.php @@ -38,7 +38,6 @@ class UserService { private $apiConfig; /** @var LDAPConnectionService */ private $LDAPConnectionService; - private $l10n; public function __construct($appName, IUserManager $userManager, IConfig $config, CurlService $curlService, ILogger $logger, Defaults $defaults, IFactory $l10nFactory, LDAPConnectionService $LDAPConnectionService) { $this->userManager = $userManager; @@ -49,7 +48,7 @@ class UserService { $this->defaults = $defaults; $this->l10nFactory = $l10nFactory; $this->LDAPConnectionService = $LDAPConnectionService; - $this->l10n = $this->l10nFactory->get("ecloud-accounts"); + $commonServiceURL = $this->config->getSystemValue('common_services_url', ''); if (!empty($commonServiceURL)) { @@ -244,18 +243,18 @@ class UserService { * @throws Exception If the username or recovery email is already taken. */ public function registerUser(string $displayname, string $recoveryEmail, string $username, string $userEmail, string $password): array { - + $l = $this->l10nFactory->get("ecloud-accounts"); if ($this->userExists($username)) { - throw new Exception($this->l10n->t('Username is already taken.')); + throw new Exception($l->t('Username is already taken.')); } if (!empty($recoveryEmail) && !$this->isValidEmailFormat($recoveryEmail)) { - throw new Exception($this->l10n->t('Recovery email address has an incorrect format.')); + throw new Exception($l->t('Recovery email address has an incorrect format.')); } if (!empty($recoveryEmail) && $this->checkRecoveryEmailAvailable($recoveryEmail)) { - throw new Exception($this->l10n->t('Recovery email address is already taken.')); + throw new Exception($l->t('Recovery email address is already taken.')); } if (!empty($recoveryEmail) && !$this->isRecoveryEmailDomainDisallowed($recoveryEmail)) { - throw new Exception($this->l10n->t('Recovery email address cannot have murena domains.')); + throw new Exception($l->t('Recovery email address cannot have murena domains.')); } return $this->addNewUserToLDAP($displayname, $recoveryEmail, $username, $userEmail, $password); -- GitLab From 43d679d20f11a7fcd012ac18ba70ec0d48518c19 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Fri, 1 Mar 2024 00:44:57 -0800 Subject: [PATCH 17/37] change in lang --- lib/Controller/AccountController.php | 2 +- lib/Service/UserService.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index 00aa714a..4f486d14 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -138,7 +138,7 @@ class AccountController extends Controller { $mainDomain = $this->userService->getMainDomain(); $userEmail = $username.'@'.$mainDomain; - $newUserEntry = $this->userService->registerUser($displayname, $recoveryEmail, $username, $userEmail, $password); + $newUserEntry = $this->userService->registerUser($displayname, $recoveryEmail, $username, $userEmail, $password, $language); $this->userService->setAccountDataLocally($username, $userEmail, $newUserEntry['quota']); $this->userService->createHMEAlias($username, $userEmail); $this->userService->createNewDomainAlias($username, $userEmail); diff --git a/lib/Service/UserService.php b/lib/Service/UserService.php index 7a443b70..5a2bde97 100644 --- a/lib/Service/UserService.php +++ b/lib/Service/UserService.php @@ -242,8 +242,9 @@ class UserService { * @return array An array containing information about the registered user. * @throws Exception If the username or recovery email is already taken. */ - public function registerUser(string $displayname, string $recoveryEmail, string $username, string $userEmail, string $password): array { - $l = $this->l10nFactory->get("ecloud-accounts"); + public function registerUser(string $displayname, string $recoveryEmail, string $username, string $userEmail, string $password, string $language): array { + $l = $this->l10nFactory->get("ecloud-accounts", $language); + if ($this->userExists($username)) { throw new Exception($l->t('Username is already taken.')); } -- GitLab From c1abe426f1efcb87c14c2c830155c9c776e487e8 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Fri, 1 Mar 2024 00:48:08 -0800 Subject: [PATCH 18/37] change in appid --- lib/Service/UserService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Service/UserService.php b/lib/Service/UserService.php index 5a2bde97..44f42c24 100644 --- a/lib/Service/UserService.php +++ b/lib/Service/UserService.php @@ -243,7 +243,7 @@ class UserService { * @throws Exception If the username or recovery email is already taken. */ public function registerUser(string $displayname, string $recoveryEmail, string $username, string $userEmail, string $password, string $language): array { - $l = $this->l10nFactory->get("ecloud-accounts", $language); + $l = $this->l10nFactory->get(Application::APP_ID, $language); if ($this->userExists($username)) { throw new Exception($l->t('Username is already taken.')); -- GitLab From b4bef6f52163d8ad3922cced66c749029126461e Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Fri, 1 Mar 2024 00:58:35 -0800 Subject: [PATCH 19/37] added --- lib/Controller/AccountController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index 4f486d14..c2b98ef0 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -104,17 +104,17 @@ class AccountController extends Controller { * @return \OCP\AppFramework\Http\DataResponse */ public function create(string $displayname = '', string $recoveryEmail = '', string $username = '', string $password = '', string $language = '', bool $newsletterEos = false, bool $newsletterProduct = false): DataResponse { - + $l = $this->l10nFactory->get(Application::APP_ID, $language); $response = new DataResponse(); if(!$this->session->get(self::CAPTCHA_VERIFIED_CHECK)) { - $response->setData(['message' => 'Captcha is not verified!', 'success' => false]); + $response->setData(['message' => $l->t('Captcha is not verified!'), 'success' => false]); $response->setStatus(400); return $response; } if (!$this->session->get(self::SESSION_USERNAME_CHECK)) { - $response->setData(['message' => 'Username is already taken.', 'success' => false]); + $response->setData(['message' => $l->t('Username is already taken.'), 'success' => false]); $response->setStatus(400); return $response; } -- GitLab From d9df582c524699121d2b5c0fc30bad3dbee2a615 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Fri, 1 Mar 2024 00:58:38 -0800 Subject: [PATCH 20/37] added --- l10n/en.js | 3 ++- l10n/en.json | 3 ++- l10n/es.js | 3 ++- l10n/es.json | 3 ++- l10n/fr.js | 3 ++- l10n/fr.json | 3 ++- l10n/it.js | 3 ++- l10n/it.json | 3 ++- 8 files changed, 16 insertions(+), 8 deletions(-) diff --git a/l10n/en.js b/l10n/en.js index b93239b3..8467c2bc 100644 --- a/l10n/en.js +++ b/l10n/en.js @@ -85,6 +85,7 @@ OC.L10N.register( "Set a recovery email address": "Set a recovery email address", "Recovery email address has an incorrect format.": "Recovery email address has an incorrect format.", "Recovery email address is already taken.": "Recovery email address is already taken.", - "Recovery email address cannot have murena domains.": "Recovery email address cannot have murena domains." + "Recovery email address cannot have murena domains.": "Recovery email address cannot have murena domains.", + "Captcha is not verified!": "Captcha is not verified!" }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/en.json b/l10n/en.json index 948fd5a6..4a410ec5 100644 --- a/l10n/en.json +++ b/l10n/en.json @@ -81,7 +81,8 @@ "Set a recovery email address": "Set a recovery email address", "Recovery email address has an incorrect format.": "Recovery email address has an incorrect format.", "Recovery email address is already taken.": "Recovery email address is already taken.", - "Recovery email address cannot have murena domains.": "Recovery email address cannot have murena domains." + "Recovery email address cannot have murena domains.": "Recovery email address cannot have murena domains.", + "Captcha is not verified!": "Captcha is not verified!" }, "pluralForm": "nplurals=2; plural=(n != 1);" } diff --git a/l10n/es.js b/l10n/es.js index 3f78aac2..9eed3dbb 100644 --- a/l10n/es.js +++ b/l10n/es.js @@ -83,6 +83,7 @@ OC.L10N.register( "Set a recovery email address": "Establecer una dirección de correo electrónico de recuperación", "Recovery email address has an incorrect format.": "La dirección de correo electrónico de recuperación tiene un formato incorrecto.", "Recovery email address is already taken.": "La dirección de correo electrónico de recuperación ya está ocupada.", - "Recovery email address cannot have murena domains.": "La dirección de correo electrónico de recuperación no puede tener dominios murena." + "Recovery email address cannot have murena domains.": "La dirección de correo electrónico de recuperación no puede tener dominios murena.", + "Captcha is not verified!": "¡Captcha no está verificado!" }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/es.json b/l10n/es.json index 337eaf2b..14e7a022 100644 --- a/l10n/es.json +++ b/l10n/es.json @@ -82,7 +82,8 @@ "Set a recovery email address": "Establecer una dirección de correo electrónico de recuperación", "Recovery email address has an incorrect format.": "La dirección de correo electrónico de recuperación tiene un formato incorrecto.", "Recovery email address is already taken.": "La dirección de correo electrónico de recuperación ya está ocupada.", - "Recovery email address cannot have murena domains.": "La dirección de correo electrónico de recuperación no puede tener dominios murena." + "Recovery email address cannot have murena domains.": "La dirección de correo electrónico de recuperación no puede tener dominios murena.", + "Captcha is not verified!": "¡Captcha no está verificado!" }, "pluralForm": "nplurals=2; plural=(n != 1);" } diff --git a/l10n/fr.js b/l10n/fr.js index b3c14833..59cefc84 100644 --- a/l10n/fr.js +++ b/l10n/fr.js @@ -82,6 +82,7 @@ OC.L10N.register( "Set a recovery email address": "Définir une adresse électronique de récupération", "Recovery email address has an incorrect format.": "L'adresse électronique de récupération ne peut pas avoir de domaines murena.", "Recovery email address is already taken.": "L'adresse électronique de récupération est déjà prise.", - "Recovery email address cannot have murena domains.": "L'adresse électronique de récupération ne peut pas avoir de domaines murena." + "Recovery email address cannot have murena domains.": "L'adresse électronique de récupération ne peut pas avoir de domaines murena.", + "Captcha is not verified!": "Captcha n'est pas vérifié !" }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/fr.json b/l10n/fr.json index 176569fe..f2bfba85 100644 --- a/l10n/fr.json +++ b/l10n/fr.json @@ -81,7 +81,8 @@ "Set a recovery email address": "Définir une adresse électronique de récupération", "Recovery email address has an incorrect format.": "L'adresse électronique de récupération ne peut pas avoir de domaines murena.", "Recovery email address is already taken.": "L'adresse électronique de récupération est déjà prise.", - "Recovery email address cannot have murena domains.": "L'adresse électronique de récupération ne peut pas avoir de domaines murena." + "Recovery email address cannot have murena domains.": "L'adresse électronique de récupération ne peut pas avoir de domaines murena.", + "Captcha is not verified!": "Captcha n'est pas vérifié !" }, "pluralForm": "nplurals=2; plural=(n != 1);" } diff --git a/l10n/it.js b/l10n/it.js index 47971a36..8213da2c 100644 --- a/l10n/it.js +++ b/l10n/it.js @@ -82,6 +82,7 @@ OC.L10N.register( "Set a recovery email address": "Impostare un indirizzo e-mail di recupero", "Recovery email address has an incorrect format.": "L'indirizzo e-mail di recupero ha un formato errato.", "Recovery email address is already taken.": "L'indirizzo e-mail di recupero è già stato preso.", - "Recovery email address cannot have murena domains.": "L'indirizzo e-mail di recupero non può avere domini murena." + "Recovery email address cannot have murena domains.": "L'indirizzo e-mail di recupero non può avere domini murena.", + "Captcha is not verified!": "Il Captcha non è verificato!" }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/it.json b/l10n/it.json index 8554fef5..0ae50623 100644 --- a/l10n/it.json +++ b/l10n/it.json @@ -77,7 +77,8 @@ "Set a recovery email address": "Impostare un indirizzo e-mail di recupero", "Recovery email address has an incorrect format.": "L'indirizzo e-mail di recupero ha un formato errato.", "Recovery email address is already taken.": "L'indirizzo e-mail di recupero è già stato preso.", - "Recovery email address cannot have murena domains.": "L'indirizzo e-mail di recupero non può avere domini murena." + "Recovery email address cannot have murena domains.": "L'indirizzo e-mail di recupero non può avere domini murena.", + "Captcha is not verified!": "Il Captcha non è verificato!" }, "pluralForm": "nplurals=2; plural=(n != 1);" } -- GitLab From 5bba80465427f0a49be938d4ad6cf158e9a517df Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Fri, 1 Mar 2024 01:00:51 -0800 Subject: [PATCH 21/37] added german --- l10n/de.js | 3 ++- l10n/de.json | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/l10n/de.js b/l10n/de.js index 72866f2b..e21eb8b3 100644 --- a/l10n/de.js +++ b/l10n/de.js @@ -81,6 +81,7 @@ OC.L10N.register( "Set a recovery email address": "Festlegen einer Wiederherstellungs-E-Mail-Adresse", "Recovery email address has an incorrect format.": "Die E-Mail-Adresse für die Wiederherstellung hat ein falsches Format.", "Recovery email address is already taken.": "Die E-Mail-Adresse für die Wiederherstellung ist bereits vergeben.", - "Recovery email address cannot have murena domains.": "Wiederherstellungs-E-Mail-Adressen können keine Murena-Domänen haben." + "Recovery email address cannot have murena domains.": "Wiederherstellungs-E-Mail-Adressen können keine Murena-Domänen haben.", + "Captcha is not verified!": "Captcha wird nicht überprüft!" }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/de.json b/l10n/de.json index 00018be8..7637d571 100644 --- a/l10n/de.json +++ b/l10n/de.json @@ -79,7 +79,8 @@ "Set a recovery email address": "Festlegen einer Wiederherstellungs-E-Mail-Adresse", "Recovery email address has an incorrect format.": "Die E-Mail-Adresse für die Wiederherstellung hat ein falsches Format.", "Recovery email address is already taken.": "Die E-Mail-Adresse für die Wiederherstellung ist bereits vergeben.", - "Recovery email address cannot have murena domains.": "Wiederherstellungs-E-Mail-Adressen können keine Murena-Domänen haben." + "Recovery email address cannot have murena domains.": "Wiederherstellungs-E-Mail-Adressen können keine Murena-Domänen haben.", + "Captcha is not verified!": "Captcha wird nicht überprüft!" }, "pluralForm": "nplurals=2; plural=(n != 1);" } -- GitLab From 9535a86eafad378b2f804553cde5a2b73216c5d1 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Mon, 4 Mar 2024 11:16:43 -0800 Subject: [PATCH 22/37] temp changes --- lib/Controller/AccountController.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index c2b98ef0..7c824af1 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -165,6 +165,8 @@ class AccountController extends Controller { $response->setData(['success' => true]); } catch (Exception $e) { + $this->session->set(self::SESSION_USERNAME_CHECK, true); + $this->session->set(self::CAPTCHA_VERIFIED_CHECK, true); $response->setData(['message' => $e->getMessage(), 'success' => false]); $response->setStatus(500); } -- GitLab From 4e9f705896c2b6210017e9e4cf454ba6413432d1 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Mon, 4 Mar 2024 11:23:46 -0800 Subject: [PATCH 23/37] temp changes --- lib/Controller/AccountController.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index 7c824af1..c2b98ef0 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -165,8 +165,6 @@ class AccountController extends Controller { $response->setData(['success' => true]); } catch (Exception $e) { - $this->session->set(self::SESSION_USERNAME_CHECK, true); - $this->session->set(self::CAPTCHA_VERIFIED_CHECK, true); $response->setData(['message' => $e->getMessage(), 'success' => false]); $response->setStatus(500); } -- GitLab From ffe7df3c0745916176b2e7253e5f447ad1092efc Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 5 Mar 2024 16:04:00 -0800 Subject: [PATCH 24/37] added changes --- lib/Service/UserService.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/Service/UserService.php b/lib/Service/UserService.php index 44f42c24..61474a48 100644 --- a/lib/Service/UserService.php +++ b/lib/Service/UserService.php @@ -248,14 +248,16 @@ class UserService { if ($this->userExists($username)) { throw new Exception($l->t('Username is already taken.')); } - if (!empty($recoveryEmail) && !$this->isValidEmailFormat($recoveryEmail)) { - throw new Exception($l->t('Recovery email address has an incorrect format.')); - } - if (!empty($recoveryEmail) && $this->checkRecoveryEmailAvailable($recoveryEmail)) { - throw new Exception($l->t('Recovery email address is already taken.')); - } - if (!empty($recoveryEmail) && !$this->isRecoveryEmailDomainDisallowed($recoveryEmail)) { - throw new Exception($l->t('Recovery email address cannot have murena domains.')); + if(!empty($recoveryEmail)) { + if (!$this->isValidEmailFormat($recoveryEmail)) { + throw new Exception($l->t('Recovery email address has an incorrect format.')); + } + if ($this->checkRecoveryEmailAvailable($recoveryEmail)) { + throw new Exception($l->t('Recovery email address is already taken.')); + } + if (!$this->isRecoveryEmailDomainDisallowed($recoveryEmail)) { + throw new Exception($l->t('Recovery email address cannot have murena domains.')); + } } return $this->addNewUserToLDAP($displayname, $recoveryEmail, $username, $userEmail, $password); -- GitLab From f0fd86b64e62c08121ceed3db542862bccfaa733 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 5 Mar 2024 16:07:24 -0800 Subject: [PATCH 25/37] en default --- 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 c2b98ef0..266a1f2e 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -103,7 +103,7 @@ class AccountController extends Controller { * * @return \OCP\AppFramework\Http\DataResponse */ - public function create(string $displayname = '', string $recoveryEmail = '', string $username = '', string $password = '', string $language = '', bool $newsletterEos = false, bool $newsletterProduct = false): DataResponse { + public function create(string $displayname = '', string $recoveryEmail = '', string $username = '', string $password = '', string $language = 'en', bool $newsletterEos = false, bool $newsletterProduct = false): DataResponse { $l = $this->l10nFactory->get(Application::APP_ID, $language); $response = new DataResponse(); -- GitLab From a595e027fdcb9bdf9bb76d7c43423aa2afa521cf Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 5 Mar 2024 16:14:32 -0800 Subject: [PATCH 26/37] return true changes --- lib/Service/UserService.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Service/UserService.php b/lib/Service/UserService.php index 61474a48..aaa30da3 100644 --- a/lib/Service/UserService.php +++ b/lib/Service/UserService.php @@ -255,7 +255,7 @@ class UserService { if ($this->checkRecoveryEmailAvailable($recoveryEmail)) { throw new Exception($l->t('Recovery email address is already taken.')); } - if (!$this->isRecoveryEmailDomainDisallowed($recoveryEmail)) { + if ($this->isRecoveryEmailDomainDisallowed($recoveryEmail)) { throw new Exception($l->t('Recovery email address cannot have murena domains.')); } } @@ -331,7 +331,7 @@ class UserService { * * @param string $recoveryEmail The recovery email address to check. * - * @return bool True if the recovery email address is valid, false otherwise. + * @return bool True if the recovery email address is disallowed, false otherwise. */ public function isRecoveryEmailDomainDisallowed(string $recoveryEmail): bool { @@ -345,7 +345,7 @@ class UserService { $restrictedDomains = [ $legacyDomain, $mainDomain ]; - return !in_array($domain, $restrictedDomains); + return in_array($domain, $restrictedDomains); } /** -- GitLab From e4aaec217861cb4819c0f74e173c8f91e319bf0a Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 5 Mar 2024 18:40:23 -0800 Subject: [PATCH 27/37] change in account --- lib/Controller/AccountController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index 266a1f2e..01cb512d 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -104,17 +104,17 @@ class AccountController extends Controller { * @return \OCP\AppFramework\Http\DataResponse */ public function create(string $displayname = '', string $recoveryEmail = '', string $username = '', string $password = '', string $language = 'en', bool $newsletterEos = false, bool $newsletterProduct = false): DataResponse { - $l = $this->l10nFactory->get(Application::APP_ID, $language); + $response = new DataResponse(); if(!$this->session->get(self::CAPTCHA_VERIFIED_CHECK)) { - $response->setData(['message' => $l->t('Captcha is not verified!'), 'success' => false]); + $response->setData(['message' => 'Captcha is not verified!', 'success' => false]); $response->setStatus(400); return $response; } if (!$this->session->get(self::SESSION_USERNAME_CHECK)) { - $response->setData(['message' => $l->t('Username is already taken.'), 'success' => false]); + $response->setData(['message' => 'Username is already taken.', 'success' => false]); $response->setStatus(400); return $response; } -- GitLab From 1a5d149efafdcf14f3642f0a3e2ddcbd86e77eca Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 5 Mar 2024 18:42:08 -0800 Subject: [PATCH 28/37] changes in userservice --- lib/Controller/AccountController.php | 2 +- lib/Service/UserService.php | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index 01cb512d..6aa58aef 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -138,7 +138,7 @@ class AccountController extends Controller { $mainDomain = $this->userService->getMainDomain(); $userEmail = $username.'@'.$mainDomain; - $newUserEntry = $this->userService->registerUser($displayname, $recoveryEmail, $username, $userEmail, $password, $language); + $newUserEntry = $this->userService->registerUser($displayname, $recoveryEmail, $username, $userEmail, $password); $this->userService->setAccountDataLocally($username, $userEmail, $newUserEntry['quota']); $this->userService->createHMEAlias($username, $userEmail); $this->userService->createNewDomainAlias($username, $userEmail); diff --git a/lib/Service/UserService.php b/lib/Service/UserService.php index aaa30da3..bc9a5103 100644 --- a/lib/Service/UserService.php +++ b/lib/Service/UserService.php @@ -242,21 +242,20 @@ class UserService { * @return array An array containing information about the registered user. * @throws Exception If the username or recovery email is already taken. */ - public function registerUser(string $displayname, string $recoveryEmail, string $username, string $userEmail, string $password, string $language): array { - $l = $this->l10nFactory->get(Application::APP_ID, $language); + public function registerUser(string $displayname, string $recoveryEmail, string $username, string $userEmail, string $password): array { if ($this->userExists($username)) { - throw new Exception($l->t('Username is already taken.')); + throw new Exception('Username is already taken.'); } if(!empty($recoveryEmail)) { if (!$this->isValidEmailFormat($recoveryEmail)) { - throw new Exception($l->t('Recovery email address has an incorrect format.')); + throw new Exception('Recovery email address has an incorrect format.'); } if ($this->checkRecoveryEmailAvailable($recoveryEmail)) { - throw new Exception($l->t('Recovery email address is already taken.')); + throw new Exception('Recovery email address is already taken.'); } if ($this->isRecoveryEmailDomainDisallowed($recoveryEmail)) { - throw new Exception($l->t('Recovery email address cannot have murena domains.')); + throw new Exception('Recovery email address cannot have murena domains.'); } } return $this->addNewUserToLDAP($displayname, $recoveryEmail, $username, $userEmail, $password); -- GitLab From 8ee39d56172b464fc497e18a17a16dd87aedda89 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 5 Mar 2024 18:42:46 -0800 Subject: [PATCH 29/37] changes in userservice --- lib/Service/UserService.php | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/Service/UserService.php b/lib/Service/UserService.php index bc9a5103..07bf9a25 100644 --- a/lib/Service/UserService.php +++ b/lib/Service/UserService.php @@ -48,7 +48,6 @@ class UserService { $this->defaults = $defaults; $this->l10nFactory = $l10nFactory; $this->LDAPConnectionService = $LDAPConnectionService; - $commonServiceURL = $this->config->getSystemValue('common_services_url', ''); if (!empty($commonServiceURL)) { -- GitLab From c6c9ceca6db148d01e7ce21063b831b96d6140d2 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 5 Mar 2024 18:45:58 -0800 Subject: [PATCH 30/37] changes in userservice --- lib/Service/UserService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Service/UserService.php b/lib/Service/UserService.php index 07bf9a25..2e5bc023 100644 --- a/lib/Service/UserService.php +++ b/lib/Service/UserService.php @@ -244,7 +244,7 @@ class UserService { public function registerUser(string $displayname, string $recoveryEmail, string $username, string $userEmail, string $password): array { if ($this->userExists($username)) { - throw new Exception('Username is already taken.'); + throw new Exception("Username is already taken."); } if(!empty($recoveryEmail)) { if (!$this->isValidEmailFormat($recoveryEmail)) { -- GitLab From dc4adbdfa348ee3e4e1fa66aaeefe93c04dd17f8 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 5 Mar 2024 18:51:26 -0800 Subject: [PATCH 31/37] added localization at frontend --- src/Signup.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Signup.vue b/src/Signup.vue index 4fa39636..bf45e180 100644 --- a/src/Signup.vue +++ b/src/Signup.vue @@ -101,7 +101,7 @@ export default { } catch (error) { // Handle network errors and unexpected response structures here const errorMessage = error.response ? error.response.data.message : error.message - this.showMessage(errorMessage, 'error') + this.showMessage(t(this.appName, errorMessage), 'error') } }, showMessage(message, type) { -- GitLab From f043f171ce6ba6686062f4b1e822967afac83572 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 5 Mar 2024 18:56:40 -0800 Subject: [PATCH 32/37] added localization at frontend --- src/Signup.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Signup.vue b/src/Signup.vue index bf45e180..ba1eb163 100644 --- a/src/Signup.vue +++ b/src/Signup.vue @@ -101,7 +101,7 @@ export default { } catch (error) { // Handle network errors and unexpected response structures here const errorMessage = error.response ? error.response.data.message : error.message - this.showMessage(t(this.appName, errorMessage), 'error') + this.showMessage(t(this.appName, 'Recovery email address cannot have murena domains.'), 'error') } }, showMessage(message, type) { -- GitLab From 3d4b8cba3c8889f9b04e0be99a5a9ac47726ee9c Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 5 Mar 2024 19:00:55 -0800 Subject: [PATCH 33/37] checking for static conversion --- src/Signup.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Signup.vue b/src/Signup.vue index ba1eb163..f43d7fc3 100644 --- a/src/Signup.vue +++ b/src/Signup.vue @@ -100,7 +100,7 @@ export default { this.showSuccessSection = true } catch (error) { // Handle network errors and unexpected response structures here - const errorMessage = error.response ? error.response.data.message : error.message + // const errorMessage = error.response ? error.response.data.message : error.message this.showMessage(t(this.appName, 'Recovery email address cannot have murena domains.'), 'error') } }, -- GitLab From 649d535305ad03e3c07ad7ff89dcd48f2632edbb Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 5 Mar 2024 19:06:40 -0800 Subject: [PATCH 34/37] t chec --- src/Signup.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Signup.vue b/src/Signup.vue index f43d7fc3..d6b2fc40 100644 --- a/src/Signup.vue +++ b/src/Signup.vue @@ -100,8 +100,8 @@ export default { this.showSuccessSection = true } catch (error) { // Handle network errors and unexpected response structures here - // const errorMessage = error.response ? error.response.data.message : error.message - this.showMessage(t(this.appName, 'Recovery email address cannot have murena domains.'), 'error') + const errorMessage = error.response ? t(this.appName, error.response.data.message) : t(this.appName, error.message) + this.showMessage(errorMessage, 'error') } }, showMessage(message, type) { -- GitLab From 9a255dbe365999caf1d38f2378a7a7501e72364a Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 5 Mar 2024 19:27:22 -0800 Subject: [PATCH 35/37] french translate --- l10n/fr.js | 2 +- l10n/fr.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/l10n/fr.js b/l10n/fr.js index 59cefc84..a63103a8 100644 --- a/l10n/fr.js +++ b/l10n/fr.js @@ -80,7 +80,7 @@ OC.L10N.register( "Important:": "Important :", "For security reasons, a recovery email is required. If you decide to set it later, your account will be partially restricted.": "Pour des raisons de sécurité, un courriel de récupération est nécessaire. Si vous décidez de le désactiver ultérieurement, votre compte sera partiellement restreint.", "Set a recovery email address": "Définir une adresse électronique de récupération", - "Recovery email address has an incorrect format.": "L'adresse électronique de récupération ne peut pas avoir de domaines murena.", + "Recovery email address has an incorrect format.": "Le format de l'adresse électronique de récupération est incorrect.", "Recovery email address is already taken.": "L'adresse électronique de récupération est déjà prise.", "Recovery email address cannot have murena domains.": "L'adresse électronique de récupération ne peut pas avoir de domaines murena.", "Captcha is not verified!": "Captcha n'est pas vérifié !" diff --git a/l10n/fr.json b/l10n/fr.json index f2bfba85..06221779 100644 --- a/l10n/fr.json +++ b/l10n/fr.json @@ -79,7 +79,7 @@ "Important:": "Important :", "For security reasons, a recovery email is required. If you decide to set it later, your account will be partially restricted.": "Pour des raisons de sécurité, un courriel de récupération est nécessaire. Si vous décidez de le désactiver ultérieurement, votre compte sera partiellement restreint.", "Set a recovery email address": "Définir une adresse électronique de récupération", - "Recovery email address has an incorrect format.": "L'adresse électronique de récupération ne peut pas avoir de domaines murena.", + "Recovery email address has an incorrect format.": "Le format de l'adresse électronique de récupération est incorrect.", "Recovery email address is already taken.": "L'adresse électronique de récupération est déjà prise.", "Recovery email address cannot have murena domains.": "L'adresse électronique de récupération ne peut pas avoir de domaines murena.", "Captcha is not verified!": "Captcha n'est pas vérifié !" -- GitLab From 5402fc072437c726f0dab06460b6d2d38f23871b Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 5 Mar 2024 19:37:44 -0800 Subject: [PATCH 36/37] change message --- l10n/de.js | 2 +- l10n/de.json | 2 +- l10n/en.js | 2 +- l10n/en.json | 2 +- l10n/es.js | 2 +- l10n/es.json | 2 +- l10n/fr.js | 2 +- l10n/fr.json | 2 +- l10n/it.js | 2 +- l10n/it.json | 2 +- lib/Service/UserService.php | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/l10n/de.js b/l10n/de.js index e21eb8b3..9785af83 100644 --- a/l10n/de.js +++ b/l10n/de.js @@ -81,7 +81,7 @@ OC.L10N.register( "Set a recovery email address": "Festlegen einer Wiederherstellungs-E-Mail-Adresse", "Recovery email address has an incorrect format.": "Die E-Mail-Adresse für die Wiederherstellung hat ein falsches Format.", "Recovery email address is already taken.": "Die E-Mail-Adresse für die Wiederherstellung ist bereits vergeben.", - "Recovery email address cannot have murena domains.": "Wiederherstellungs-E-Mail-Adressen können keine Murena-Domänen haben.", + "You cannot set an email address with a Murena domain as recovery email address.": "Sie können keine E-Mail-Adresse mit einer Murena-Domäne als Wiederherstellungs-E-Mail-Adresse festlegen.", "Captcha is not verified!": "Captcha wird nicht überprüft!" }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/de.json b/l10n/de.json index 7637d571..09a7588c 100644 --- a/l10n/de.json +++ b/l10n/de.json @@ -79,7 +79,7 @@ "Set a recovery email address": "Festlegen einer Wiederherstellungs-E-Mail-Adresse", "Recovery email address has an incorrect format.": "Die E-Mail-Adresse für die Wiederherstellung hat ein falsches Format.", "Recovery email address is already taken.": "Die E-Mail-Adresse für die Wiederherstellung ist bereits vergeben.", - "Recovery email address cannot have murena domains.": "Wiederherstellungs-E-Mail-Adressen können keine Murena-Domänen haben.", + "You cannot set an email address with a Murena domain as recovery email address.": "Sie können keine E-Mail-Adresse mit einer Murena-Domäne als Wiederherstellungs-E-Mail-Adresse festlegen.", "Captcha is not verified!": "Captcha wird nicht überprüft!" }, "pluralForm": "nplurals=2; plural=(n != 1);" diff --git a/l10n/en.js b/l10n/en.js index 8467c2bc..3d9794a3 100644 --- a/l10n/en.js +++ b/l10n/en.js @@ -85,7 +85,7 @@ OC.L10N.register( "Set a recovery email address": "Set a recovery email address", "Recovery email address has an incorrect format.": "Recovery email address has an incorrect format.", "Recovery email address is already taken.": "Recovery email address is already taken.", - "Recovery email address cannot have murena domains.": "Recovery email address cannot have murena domains.", + "You cannot set an email address with a Murena domain as recovery email address.": "You cannot set an email address with a Murena domain as recovery email address.", "Captcha is not verified!": "Captcha is not verified!" }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/en.json b/l10n/en.json index 4a410ec5..d61942f9 100644 --- a/l10n/en.json +++ b/l10n/en.json @@ -81,7 +81,7 @@ "Set a recovery email address": "Set a recovery email address", "Recovery email address has an incorrect format.": "Recovery email address has an incorrect format.", "Recovery email address is already taken.": "Recovery email address is already taken.", - "Recovery email address cannot have murena domains.": "Recovery email address cannot have murena domains.", + "You cannot set an email address with a Murena domain as recovery email address.": "You cannot set an email address with a Murena domain as recovery email address.", "Captcha is not verified!": "Captcha is not verified!" }, "pluralForm": "nplurals=2; plural=(n != 1);" diff --git a/l10n/es.js b/l10n/es.js index 9eed3dbb..72f2b282 100644 --- a/l10n/es.js +++ b/l10n/es.js @@ -83,7 +83,7 @@ OC.L10N.register( "Set a recovery email address": "Establecer una dirección de correo electrónico de recuperación", "Recovery email address has an incorrect format.": "La dirección de correo electrónico de recuperación tiene un formato incorrecto.", "Recovery email address is already taken.": "La dirección de correo electrónico de recuperación ya está ocupada.", - "Recovery email address cannot have murena domains.": "La dirección de correo electrónico de recuperación no puede tener dominios murena.", + "You cannot set an email address with a Murena domain as recovery email address.": "No puede establecer una dirección de correo electrónico con un dominio de Murena como dirección de correo electrónico de recuperación.", "Captcha is not verified!": "¡Captcha no está verificado!" }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/es.json b/l10n/es.json index 14e7a022..409ea77b 100644 --- a/l10n/es.json +++ b/l10n/es.json @@ -82,7 +82,7 @@ "Set a recovery email address": "Establecer una dirección de correo electrónico de recuperación", "Recovery email address has an incorrect format.": "La dirección de correo electrónico de recuperación tiene un formato incorrecto.", "Recovery email address is already taken.": "La dirección de correo electrónico de recuperación ya está ocupada.", - "Recovery email address cannot have murena domains.": "La dirección de correo electrónico de recuperación no puede tener dominios murena.", + "You cannot set an email address with a Murena domain as recovery email address.": "No puede establecer una dirección de correo electrónico con un dominio de Murena como dirección de correo electrónico de recuperación.", "Captcha is not verified!": "¡Captcha no está verificado!" }, "pluralForm": "nplurals=2; plural=(n != 1);" diff --git a/l10n/fr.js b/l10n/fr.js index a63103a8..2b327ea3 100644 --- a/l10n/fr.js +++ b/l10n/fr.js @@ -82,7 +82,7 @@ OC.L10N.register( "Set a recovery email address": "Définir une adresse électronique de récupération", "Recovery email address has an incorrect format.": "Le format de l'adresse électronique de récupération est incorrect.", "Recovery email address is already taken.": "L'adresse électronique de récupération est déjà prise.", - "Recovery email address cannot have murena domains.": "L'adresse électronique de récupération ne peut pas avoir de domaines murena.", + "You cannot set an email address with a Murena domain as recovery email address.": "Vous ne pouvez pas définir une adresse électronique avec un domaine Murena comme adresse électronique de récupération.", "Captcha is not verified!": "Captcha n'est pas vérifié !" }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/fr.json b/l10n/fr.json index 06221779..26fcbfef 100644 --- a/l10n/fr.json +++ b/l10n/fr.json @@ -81,7 +81,7 @@ "Set a recovery email address": "Définir une adresse électronique de récupération", "Recovery email address has an incorrect format.": "Le format de l'adresse électronique de récupération est incorrect.", "Recovery email address is already taken.": "L'adresse électronique de récupération est déjà prise.", - "Recovery email address cannot have murena domains.": "L'adresse électronique de récupération ne peut pas avoir de domaines murena.", + "You cannot set an email address with a Murena domain as recovery email address.": "Vous ne pouvez pas définir une adresse électronique avec un domaine Murena comme adresse électronique de récupération.", "Captcha is not verified!": "Captcha n'est pas vérifié !" }, "pluralForm": "nplurals=2; plural=(n != 1);" diff --git a/l10n/it.js b/l10n/it.js index 8213da2c..f3cf4249 100644 --- a/l10n/it.js +++ b/l10n/it.js @@ -82,7 +82,7 @@ OC.L10N.register( "Set a recovery email address": "Impostare un indirizzo e-mail di recupero", "Recovery email address has an incorrect format.": "L'indirizzo e-mail di recupero ha un formato errato.", "Recovery email address is already taken.": "L'indirizzo e-mail di recupero è già stato preso.", - "Recovery email address cannot have murena domains.": "L'indirizzo e-mail di recupero non può avere domini murena.", + "You cannot set an email address with a Murena domain as recovery email address.": "Non è possibile impostare un indirizzo e-mail con un dominio Murena come indirizzo e-mail di recupero.", "Captcha is not verified!": "Il Captcha non è verificato!" }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/it.json b/l10n/it.json index 0ae50623..e4ad86d6 100644 --- a/l10n/it.json +++ b/l10n/it.json @@ -77,7 +77,7 @@ "Set a recovery email address": "Impostare un indirizzo e-mail di recupero", "Recovery email address has an incorrect format.": "L'indirizzo e-mail di recupero ha un formato errato.", "Recovery email address is already taken.": "L'indirizzo e-mail di recupero è già stato preso.", - "Recovery email address cannot have murena domains.": "L'indirizzo e-mail di recupero non può avere domini murena.", + "You cannot set an email address with a Murena domain as recovery email address.": "Non è possibile impostare un indirizzo e-mail con un dominio Murena come indirizzo e-mail di recupero.", "Captcha is not verified!": "Il Captcha non è verificato!" }, "pluralForm": "nplurals=2; plural=(n != 1);" diff --git a/lib/Service/UserService.php b/lib/Service/UserService.php index 2e5bc023..f108b3d4 100644 --- a/lib/Service/UserService.php +++ b/lib/Service/UserService.php @@ -254,7 +254,7 @@ class UserService { throw new Exception('Recovery email address is already taken.'); } if ($this->isRecoveryEmailDomainDisallowed($recoveryEmail)) { - throw new Exception('Recovery email address cannot have murena domains.'); + throw new Exception('You cannot set an email address with a Murena domain as recovery email address.'); } } return $this->addNewUserToLDAP($displayname, $recoveryEmail, $username, $userEmail, $password); -- GitLab From 5ec720077d27ce526d7d4327abd52ff6e784c7c3 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 5 Mar 2024 22:58:08 -0800 Subject: [PATCH 37/37] added new function --- lib/Service/UserService.php | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/lib/Service/UserService.php b/lib/Service/UserService.php index f108b3d4..b6097b37 100644 --- a/lib/Service/UserService.php +++ b/lib/Service/UserService.php @@ -246,20 +246,30 @@ class UserService { if ($this->userExists($username)) { throw new Exception("Username is already taken."); } - if(!empty($recoveryEmail)) { - if (!$this->isValidEmailFormat($recoveryEmail)) { - throw new Exception('Recovery email address has an incorrect format.'); - } - if ($this->checkRecoveryEmailAvailable($recoveryEmail)) { - throw new Exception('Recovery email address is already taken.'); - } - if ($this->isRecoveryEmailDomainDisallowed($recoveryEmail)) { - throw new Exception('You cannot set an email address with a Murena domain as recovery email address.'); - } + if (!empty($recoveryEmail)) { + $this->validateRecoveryEmail($recoveryEmail); } return $this->addNewUserToLDAP($displayname, $recoveryEmail, $username, $userEmail, $password); } + /** + * Validates the recovery email address. + * + * @param string $recoveryEmail The recovery email address to be validated. + * @throws Exception If the recovery email address has an incorrect format, is already taken, or if the domain is disallowed. + * @return void + */ + public function validateRecoveryEmail(string $recoveryEmail): void { + if (!$this->isValidEmailFormat($recoveryEmail)) { + throw new Exception('Recovery email address has an incorrect format.'); + } + if ($this->checkRecoveryEmailAvailable($recoveryEmail)) { + throw new Exception('Recovery email address is already taken.'); + } + if ($this->isRecoveryEmailDomainDisallowed($recoveryEmail)) { + throw new Exception('You cannot set an email address with a Murena domain as recovery email address.'); + } + } /** * Add a new user to the LDAP directory. * -- GitLab