diff --git a/appinfo/info.xml b/appinfo/info.xml
index a4d9725f18be6901c194a7a52bd61a9e614ee416..0d326733cacb7f83418276e9b80b5d19b32902b9 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/l10n/de.js b/l10n/de.js
index d12d723b8d76694d5e3f1e57367299e6e08eebea..9785af83ed69159556a6ca7595a384a4df9cad97 100644
--- a/l10n/de.js
+++ b/l10n/de.js
@@ -78,6 +78,10 @@ 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.",
+ "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 1acdb33c9a0be547b6248363147c9406ac00d12f..09a7588c375933ba373c382895eebf3ad9ac68e4 100644
--- a/l10n/de.json
+++ b/l10n/de.json
@@ -76,7 +76,11 @@
"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.",
+ "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 cf71a7458e1eac5d98fea512edb104109e3bedba..3d9794a3f33d5f8956a2f26dbcec615a4bc8422f 100644
--- a/l10n/en.js
+++ b/l10n/en.js
@@ -82,6 +82,10 @@ 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.",
+ "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 51a28a357c029aa709bf8f7984e95dbafb9fcdd4..d61942f92117d6eef2b0eb6ffa6c2287c966bd10 100644
--- a/l10n/en.json
+++ b/l10n/en.json
@@ -78,7 +78,11 @@
"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.",
+ "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 a6cf885bf61c19fe380d20ffdf60a1c557ad80c5..72f2b2822c18eba0d4c5594f9894c36542ec277c 100644
--- a/l10n/es.js
+++ b/l10n/es.js
@@ -80,6 +80,10 @@ 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.",
+ "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 45441c31e73d149836c2402d8def50007d8e6ecd..409ea77bc59760a793d418e51a9965aa2c48674e 100644
--- a/l10n/es.json
+++ b/l10n/es.json
@@ -79,7 +79,11 @@
"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.",
+ "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 02a080b25d4c197bb5fea8c13ce5693e17732564..2b327ea311163255046fdbdbce8c9d4e6df84925 100644
--- a/l10n/fr.js
+++ b/l10n/fr.js
@@ -79,6 +79,10 @@ 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.": "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.",
+ "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 83a3ff78a140e44d356fd1ab68ef993f2a9ac580..26fcbfefa76dc2647a1eab1c1b4aa73d1575235f 100644
--- a/l10n/fr.json
+++ b/l10n/fr.json
@@ -78,7 +78,11 @@
"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.": "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.",
+ "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 356b12841160c573d07d78ac91ba9f4590104d1b..f3cf4249b9b06ebc6eea2c2ab1942e5db3110cf5 100644
--- a/l10n/it.js
+++ b/l10n/it.js
@@ -79,6 +79,10 @@ 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.",
+ "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 7c62999bce53f83274048fdfc24daf28c4b5ba3e..e4ad86d6925c0107b1cb0df8300d6f82e8e039fd 100644
--- a/l10n/it.json
+++ b/l10n/it.json
@@ -74,7 +74,11 @@
"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.",
+ "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/Controller/AccountController.php b/lib/Controller/AccountController.php
index 00aa714a6f23e14e2bcafe407d3e23520b7ec469..6aa58aef6433ff54797a846ea02498c771edb505 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 {
$response = new DataResponse();
diff --git a/lib/Service/UserService.php b/lib/Service/UserService.php
index c4c187ac9e41ae36917102b0dff7028152537027..b6097b373cbd6b372e4e4f8ed26f55604877341f 100644
--- a/lib/Service/UserService.php
+++ b/lib/Service/UserService.php
@@ -200,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);
}
@@ -239,16 +242,34 @@ 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 {
-
+
if ($this->userExists($username)) {
throw new Exception("Username is already taken.");
}
- if (!empty($recoveryEmail) && $this->checkRecoveryEmailAvailable($recoveryEmail)) {
- throw new Exception("Recovery email address is already taken.");
+ 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.
*
@@ -313,6 +334,39 @@ class UserService {
return false;
}
+ /**
+ * Check if a recovery email address domain is restricted for some domains
+ *
+ * @param string $recoveryEmail The recovery email address to check.
+ *
+ * @return bool True if the recovery email address is disallowed, false otherwise.
+ */
+ public function isRecoveryEmailDomainDisallowed(string $recoveryEmail): bool {
+
+ $recoveryEmail = strtolower($recoveryEmail);
+
+ $emailParts = explode('@', $recoveryEmail);
+ $domain = $emailParts[1] ?? '';
+
+ $legacyDomain = $this->getLegacyDomain();
+ $mainDomain = $this->getMainDomain();
+
+ $restrictedDomains = [ $legacyDomain, $mainDomain ];
+
+ return in_array($domain, $restrictedDomains);
+ }
+
+ /**
+ * 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.
*
diff --git a/src/Signup.vue b/src/Signup.vue
index 4fa39636d72f85db7a33ea3bc6cf93278ba57b48..d6b2fc4050954fe523e2d15c0f2641839bf24140 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 ? t(this.appName, error.response.data.message) : t(this.appName, error.message)
this.showMessage(errorMessage, 'error')
}
},