diff --git a/l10n/de.js b/l10n/de.js index 9785af83ed69159556a6ca7595a384a4df9cad97..8598186822ec82419536dc37c527d485f0a6b221 100644 --- a/l10n/de.js +++ b/l10n/de.js @@ -82,6 +82,7 @@ OC.L10N.register( "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!" + "Captcha is not verified!": "Captcha wird nicht überprüft!", + "A server-side error occurred while processing your request! Please try again later.": "Ein serverseitiger Fehler ist bei der Bearbeitung Ihrer Anfrage aufgetreten! Bitte versuchen Sie es später noch einmal." }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/de.json b/l10n/de.json index 09a7588c375933ba373c382895eebf3ad9ac68e4..93a91342e433e42322ad0406582f34d1b4847639 100644 --- a/l10n/de.json +++ b/l10n/de.json @@ -80,7 +80,8 @@ "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!" + "Captcha is not verified!": "Captcha wird nicht überprüft!", + "A server-side error occurred while processing your request! Please try again later.": "Ein serverseitiger Fehler ist bei der Bearbeitung Ihrer Anfrage aufgetreten! Bitte versuchen Sie es später noch einmal." }, "pluralForm": "nplurals=2; plural=(n != 1);" } diff --git a/l10n/en.js b/l10n/en.js index 3d9794a3f33d5f8956a2f26dbcec615a4bc8422f..70409d73331a319537989f5395c0093877f5dc5c 100644 --- a/l10n/en.js +++ b/l10n/en.js @@ -86,6 +86,7 @@ OC.L10N.register( "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!" + "Captcha is not verified!": "Captcha is not verified!", + "A server-side error occurred while processing your request! Please try again later.": "A server-side error occurred while processing your request! Please try again later." }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/en.json b/l10n/en.json index d61942f92117d6eef2b0eb6ffa6c2287c966bd10..cb4466117c30babd0aa6eb1d32b420ab9aeb1cd0 100644 --- a/l10n/en.json +++ b/l10n/en.json @@ -82,7 +82,8 @@ "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!" + "Captcha is not verified!": "Captcha is not verified!", + "A server-side error occurred while processing your request! Please try again later.": "A server-side error occurred while processing your request! Please try again later." }, "pluralForm": "nplurals=2; plural=(n != 1);" } diff --git a/l10n/es.js b/l10n/es.js index 72f2b2822c18eba0d4c5594f9894c36542ec277c..619717cb9ae36c425e95fc44c8977c1df13f9fde 100644 --- a/l10n/es.js +++ b/l10n/es.js @@ -84,6 +84,7 @@ OC.L10N.register( "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!" + "Captcha is not verified!": "¡Captcha no está verificado!", + "A server-side error occurred while processing your request! Please try again later.": "Hubo un error en el servidor al procesar tu solicitud. Por favor, inténtalo más tarde." }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/es.json b/l10n/es.json index 409ea77bc59760a793d418e51a9965aa2c48674e..13871c869920d97b294cfe01d0175c30697aa70e 100644 --- a/l10n/es.json +++ b/l10n/es.json @@ -83,7 +83,8 @@ "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!" + "Captcha is not verified!": "¡Captcha no está verificado!", + "A server-side error occurred while processing your request! Please try again later.": "Hubo un error en el servidor al procesar tu solicitud. Por favor, inténtalo más tarde." }, "pluralForm": "nplurals=2; plural=(n != 1);" } diff --git a/l10n/fr.js b/l10n/fr.js index 2b327ea311163255046fdbdbce8c9d4e6df84925..2c4914e00b1230b4a04de37a5330540c8cdbaaf4 100644 --- a/l10n/fr.js +++ b/l10n/fr.js @@ -83,6 +83,7 @@ OC.L10N.register( "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é !" + "Captcha is not verified!": "Captcha n'est pas vérifié !", + "A server-side error occurred while processing your request! Please try again later.": "Erreur du serveur dans la gestion de votre demande ! Merci d'essayer ultérieurement." }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/fr.json b/l10n/fr.json index 26fcbfefa76dc2647a1eab1c1b4aa73d1575235f..60e11c06121b9a637af2e4ba8ef532ecb5638ca8 100644 --- a/l10n/fr.json +++ b/l10n/fr.json @@ -82,7 +82,8 @@ "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é !" + "Captcha is not verified!": "Captcha n'est pas vérifié !", + "A server-side error occurred while processing your request! Please try again later.": "Erreur du serveur dans la gestion de votre demande ! Merci d'essayer ultérieurement." }, "pluralForm": "nplurals=2; plural=(n != 1);" } diff --git a/l10n/it.js b/l10n/it.js index f3cf4249b9b06ebc6eea2c2ab1942e5db3110cf5..7a246e1e80d3161fd8888874ba040d9b8af666bf 100644 --- a/l10n/it.js +++ b/l10n/it.js @@ -83,6 +83,7 @@ OC.L10N.register( "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!" + "Captcha is not verified!": "Il Captcha non è verificato!", + "A server-side error occurred while processing your request! Please try again later.": "Si è verificato un errore lato server nel processare la tua richiesta! Ritenta più tardi." }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/it.json b/l10n/it.json index e4ad86d6925c0107b1cb0df8300d6f82e8e039fd..a62613bd7e57b08bdc54d89c8496138fbce24634 100644 --- a/l10n/it.json +++ b/l10n/it.json @@ -78,7 +78,8 @@ "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!" + "Captcha is not verified!": "Il Captcha non è verificato!", + "A server-side error occurred while processing your request! Please try again later.": "Si è verificato un errore lato server nel processare la tua richiesta! Ritenta più tardi." }, "pluralForm": "nplurals=2; plural=(n != 1);" } diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index 6aa58aef6433ff54797a846ea02498c771edb505..18a1613a76a62d7c36f1913618a6d9ec74d5b766 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -137,8 +137,9 @@ class AccountController extends Controller { try { $mainDomain = $this->userService->getMainDomain(); $userEmail = $username.'@'.$mainDomain; - $newUserEntry = $this->userService->registerUser($displayname, $recoveryEmail, $username, $userEmail, $password); + sleep(2); + $this->userService->setAccountDataLocally($username, $userEmail, $newUserEntry['quota']); $this->userService->createHMEAlias($username, $userEmail); $this->userService->createNewDomainAlias($username, $userEmail); @@ -160,10 +161,13 @@ class AccountController extends Controller { } catch (Exception $e) { $this->logger->logException($e, ['app' => Application::APP_ID]); } - $response->setStatus(200); $response->setData(['success' => true]); + } catch (LDAPUserCreationException | Error $e) { + $this->logger->logException($e, ['app' => Application::APP_ID]); + $response->setData(['message' => 'A server-side error occurred while processing your request! Please try again later.', 'success' => false]); + $response->setStatus(500); } catch (Exception $e) { $response->setData(['message' => $e->getMessage(), 'success' => false]); $response->setStatus(500); diff --git a/lib/Exception/LDAPUserCreationException.php b/lib/Exception/LDAPUserCreationException.php new file mode 100644 index 0000000000000000000000000000000000000000..bfdd7cb83656efdf43a1eab447fb8981fcb8e5e6 --- /dev/null +++ b/lib/Exception/LDAPUserCreationException.php @@ -0,0 +1,9 @@ +LDAPConnectionService->getLDAPConnection(); - $base = $this->LDAPConnectionService->getLDAPBaseUsers()[0]; + $connection = $this->LDAPConnectionService->getLDAPConnection(); + $base = $this->LDAPConnectionService->getLDAPBaseUsers()[0]; - $newUserDN = "username=$username," . $base; + $newUserDN = "username=$username," . $base; - $newUserEntry = [ - 'mailAddress' => $userEmail, - 'username' => $username, - 'usernameWithoutDomain' => $username, - 'userPassword' => $password, - 'displayName' => $displayname, - 'quota' => $this->LDAPConnectionService->getLdapQuota(), - 'recoveryMailAddress' => $recoveryEmail, - 'active' => 'TRUE', - 'mailActive' => 'TRUE', - 'userClusterID' => $this->apiConfig['userCluserId'], - 'objectClass' => $this->apiConfig['objectClass'] - ]; - - $ret = ldap_add($connection, $newUserDN, $newUserEntry); + $newUserEntry = [ + 'mailAddress' => $userEmail, + 'username' => $username, + 'usernameWithoutDomain' => $username, + 'userPassword' => $password, + 'displayName' => $displayname, + 'quota' => $this->LDAPConnectionService->getLdapQuota(), + 'recoveryMailAddress' => $recoveryEmail, + 'active' => 'TRUE', + 'mailActive' => 'TRUE', + 'userClusterID' => $this->apiConfig['userCluserId'], + 'objectClass' => $this->apiConfig['objectClass'] + ]; + + $ret = ldap_add($connection, $newUserDN, $newUserEntry); - if (!$ret) { - throw new Exception("Error while creating Murena account."); - } - return $newUserEntry; - } catch (Exception $e) { - $this->logger->error('Error adding adding new user to LDAP: ' . $username . ': ' . $e->getMessage()); - return null; + if (!$ret) { + throw new LDAPUserCreationException("Error while adding entry to LDAP for username: " . $username . ' Error: ' . ldap_error($connection), ldap_errno($connection)); } + return $newUserEntry; } /** * Check if a recovery email address is available (not already taken by another user). @@ -441,7 +438,6 @@ class UserService { * @return void */ public function setAccountDataLocally(string $uid, string $mailAddress, string $quota): void { - $user = $this->getUser($uid); if (is_null($user)) { $this->logger->error('User not found');