diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 68fe5ad2566a95bce6d5547d0ba919f6f4b42c93..c268fb416407405123e82aff08afb104096bbbe4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,5 @@ variables: - TO_PACKAGE: 'appinfo l10n lib templates js img' + TO_PACKAGE: 'appinfo l10n lib templates js img css' include: - project: "e/infra/ecloud/nextcloud-apps/ci-templates" ref: main diff --git a/appinfo/routes.php b/appinfo/routes.php index 5eab965ea3d126f9d4dd68f149b5556a990a0ecc..e89d7d76f68ff12c5b1ecada5f09c215fba1ab52 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -25,7 +25,8 @@ return ['routes' => [ 'url' => '/issue/submit', 'verb' => 'POST' ], - ['name' => 'account#index', 'url' => '/accounts/{lang}/signup', 'verb' => 'GET'], + ['name' => 'account#index', 'url' => '/accounts/{lang}/signup', 'verb' => 'GET', 'postfix' => 'signwithlang'], + ['name' => 'account#index', 'url' => '/accounts/signup', 'verb' => 'GET', 'postfix' => 'signwithoutlang'], ['name' => 'account#create', 'url' => '/accounts/create', 'verb' => 'POST'], ['name' => 'account#captcha', 'url' => '/accounts/captcha', 'verb' => 'GET'], ['name' => 'account#verify_captcha', 'url' => '/accounts/verify_captcha', 'verb' => 'POST'], diff --git a/css/ecloud-accounts-userregistration.css b/css/ecloud-accounts-userregistration.css new file mode 100644 index 0000000000000000000000000000000000000000..895b680cfd099b06ed8d82e311bbe6d386669cba --- /dev/null +++ b/css/ecloud-accounts-userregistration.css @@ -0,0 +1,46 @@ +html { + background: var(--color-main-background); +} + +#body-login .warning-messsage { + width: 100% !important; +} + +#body-login .v-align { + align-items: flex-start !important; + justify-content: flex-start !important; +} + +.v-align header { + width: 100% !important; + display: flex !important; + align-items: flex-start !important; + justify-content: flex-start !important; +} + +#header { + padding-left: 5% !important; +} + +.v-align main { + width: 50% !important; + margin: 0 auto; +} + +.password-group #password { + height: 58px !important; +} + +@media only screen and (max-width: 768px) { + .v-align main { + width: 100% !important; + } + + #body-login .v-align { + padding: 5vh 0vh !important; + } +} + +#fields-password .Password__strength-meter { + margin-bottom: 0; +} \ No newline at end of file diff --git a/img/expand_more.svg b/img/expand_more.svg new file mode 100644 index 0000000000000000000000000000000000000000..5227f5d16af4372380f5df2bd8344f7484b0e045 --- /dev/null +++ b/img/expand_more.svg @@ -0,0 +1,3 @@ + + + diff --git a/l10n/de.js b/l10n/de.js index a205f974de6b75a4b391f1af76ae9c6aa7307c53..2c564a7494433f2063874429452f30e092f07bb5 100644 --- a/l10n/de.js +++ b/l10n/de.js @@ -73,6 +73,7 @@ OC.L10N.register( "I have read and accept the Terms of Service.": "Ich habe die Nutzungsbedingungen gelesen und akzeptiere diese.", "Success!": "Erfolgreich!", "Your __username__@__domain__ account was successfully created.": "Ihr __username__@__domain__-Konto wurde erfolgreich erstellt.", - "If you want to use your murena.io email in a mail app like Thunderbird, Outlook or another, please visit this page.": "Wenn Sie Ihre murena.io-E-Mail in einer Mail-Anwendung wie Thunderbird, Outlook oder einer anderen nutzen möchten, besuchen Sie bitte diese Seite." + "If you want to use your murena.io email in a mail app like Thunderbird, Outlook or another, please visit this page.": "Wenn Sie Ihre murena.io-E-Mail in einer Mail-Anwendung wie Thunderbird, Outlook oder einer anderen nutzen möchten, besuchen Sie bitte diese Seite.", + "Incorrect password length: Required length is 8 to 32": "Falsche Passwortlänge: Erforderliche Länge ist 8 bis 32" }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/de.json b/l10n/de.json index 54c2e88853eb257e06a34536078a21c95315d46d..fdc003d311e1ff1dcba0d4939ffcc91d5b1ff290 100644 --- a/l10n/de.json +++ b/l10n/de.json @@ -71,7 +71,8 @@ "I have read and accept the Terms of Service.": "Ich habe die Nutzungsbedingungen gelesen und akzeptiere diese.", "Success!": "Erfolgreich!", "Your __username__@__domain__ account was successfully created.": "Ihr __username__@__domain__-Konto wurde erfolgreich erstellt.", - "If you want to use your murena.io email in a mail app like Thunderbird, Outlook or another, please visit this page.": "Wenn Sie Ihre murena.io-E-Mail in einer Mail-Anwendung wie Thunderbird, Outlook oder einer anderen nutzen möchten, besuchen Sie bitte diese Seite." + "If you want to use your murena.io email in a mail app like Thunderbird, Outlook or another, please visit this page.": "Wenn Sie Ihre murena.io-E-Mail in einer Mail-Anwendung wie Thunderbird, Outlook oder einer anderen nutzen möchten, besuchen Sie bitte diese Seite.", + "Incorrect password length: Required length is 8 to 32": "Falsche Passwortlänge: Erforderliche Länge ist 8 bis 32" }, "pluralForm": "nplurals=2; plural=(n != 1);" } diff --git a/l10n/en.js b/l10n/en.js index 3a55d272e30aa998621a017494d6eed82a7b83b7..9cb3afc8c5e2a3c581d8306e0b9ba978d1b29007 100644 --- a/l10n/en.js +++ b/l10n/en.js @@ -76,8 +76,8 @@ OC.L10N.register( "I have read and accept the Terms of Service.": "I have read and accept the Terms of Service.", "Success!": "Success!", "Your __username__@__domain__ account was successfully created.": "Your __username__@__domain__ account was successfully created.", - "If you want to use your murena.io email in a mail app like Thunderbird, Outlook or another, please visit this page.": "If you want to use your murena.io email in a mail app like Thunderbird, Outlook or another, please visit this page.", - - "Recovery email address is already taken.": "Recovery email address is already taken." + "If you want to use your murena.io email in a mail app like Thunderbird, Outlook or another, please visit this page.": "If you want to use your murena.io email in a mail app like Thunderbird, Outlook or another, please visit this page.", + "Recovery email address is already taken.": "Recovery email address is already taken.", + "Incorrect password length: Required length is 8 to 32": "Incorrect password length: Required length is 8 to 32" }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/en.json b/l10n/en.json index 5d15841a073b134fa513550f84bb7c0574984e43..eb5fac3a7e05d9a8517145a0934c04b989563a5f 100644 --- a/l10n/en.json +++ b/l10n/en.json @@ -73,7 +73,8 @@ "I have read and accept the Terms of Service.": "I have read and accept the Terms of Service.", "Success!": "Success!", "Your __username__@__domain__ account was successfully created.": "Your __username__@__domain__ account was successfully created.", - "If you want to use your murena.io email in a mail app like Thunderbird, Outlook or another, please visit this page.": "If you want to use your murena.io email in a mail app like Thunderbird, Outlook or another, please visit this page." + "If you want to use your murena.io email in a mail app like Thunderbird, Outlook or another, please visit this page.": "If you want to use your murena.io email in a mail app like Thunderbird, Outlook or another, please visit this page.", + "Incorrect password length: Required length is 8 to 32": "Incorrect password length: Required length is 8 to 32" }, "pluralForm": "nplurals=2; plural=(n != 1);" } diff --git a/l10n/es.js b/l10n/es.js index ea832b365aed404846ddb56b04551c75a9342f21..f4f64e8ecaf936cecc2686fffcdd8a0163c86b8d 100644 --- a/l10n/es.js +++ b/l10n/es.js @@ -75,6 +75,7 @@ OC.L10N.register( "I have read and accept the Terms of Service.": "He leído y acepto las Condiciones del servicio.", "Success!": "¡Éxito!", "Your __username__@__domain__ account was successfully created.": "Su cuenta __username__@__domain__ se ha creado correctamente.", - "If you want to use your murena.io email in a mail app like Thunderbird, Outlook or another, please visit this page.": "Si desea utilizar su correo electrónico de murena.io en una aplicación de correo como Thunderbird, Outlook u otra, visite esta página.", + "If you want to use your murena.io email in a mail app like Thunderbird, Outlook or another, please visit this page.": "Si desea utilizar su correo electrónico de murena.io en una aplicación de correo como Thunderbird, Outlook u otra, visite esta página.", + "Incorrect password length: Required length is 8 to 32": "Longitud de contraseña incorrecta: La longitud requerida es de 8 a 32" }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/es.json b/l10n/es.json index e5c3daa6daf6bd5a6e22003c243a7e269eb07c2c..eee55840d777d09d68d347aff185241ec71716ae 100644 --- a/l10n/es.json +++ b/l10n/es.json @@ -74,7 +74,8 @@ "I have read and accept the Terms of Service.": "He leído y acepto las Condiciones del servicio.", "Success!": "¡Éxito!", "Your __username__@__domain__ account was successfully created.": "Su cuenta __username__@__domain__ se ha creado correctamente.", - "If you want to use your murena.io email in a mail app like Thunderbird, Outlook or another, please visit this page.": "Si desea utilizar su correo electrónico de murena.io en una aplicación de correo como Thunderbird, Outlook u otra, visite esta página." + "If you want to use your murena.io email in a mail app like Thunderbird, Outlook or another, please visit this page.": "Si desea utilizar su correo electrónico de murena.io en una aplicación de correo como Thunderbird, Outlook u otra, visite esta página.", + "Incorrect password length: Required length is 8 to 32": "Longitud de contraseña incorrecta: La longitud requerida es de 8 a 32" }, "pluralForm": "nplurals=2; plural=(n != 1);" } diff --git a/l10n/fr.js b/l10n/fr.js index 81fb0b815e31104adc940f6eb9b35f5a35f49b49..dea43d8d118fc09a6dfc2b292bf25ac129c06ec4 100644 --- a/l10n/fr.js +++ b/l10n/fr.js @@ -74,6 +74,7 @@ OC.L10N.register( "I have read and accept the Terms of Service.": "J'ai lu et j'accepte les Termes de service.", "Success!": "Succès !", "Your __username__@__domain__ account was successfully created.": "Votre compte __username__@__domain__ a été créé avec succès.", - "If you want to use your murena.io email in a mail app like Thunderbird, Outlook or another, please visit this page.": "Si vous souhaitez utiliser votre email murena.io dans une application de messagerie comme Thunderbird, Outlook ou autre, veuillez visiter cette page." + "If you want to use your murena.io email in a mail app like Thunderbird, Outlook or another, please visit this page.": "Si vous souhaitez utiliser votre email murena.io dans une application de messagerie comme Thunderbird, Outlook ou autre, veuillez visiter cette page.", + "Incorrect password length: Required length is 8 to 32":"ngueur de mot de passe incorrecte : La longueur requise est comprise entre 8 et 32" }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/fr.json b/l10n/fr.json index a371d46de95a16641ee43c65b4ee767cf5036f5f..e733fab18b8cc2a7a9c17fc8f8620d89650fd3d8 100644 --- a/l10n/fr.json +++ b/l10n/fr.json @@ -73,7 +73,8 @@ "I have read and accept the Terms of Service.": "J'ai lu et j'accepte les Termes de service.", "Success!": "Succès !", "Your __username__@__domain__ account was successfully created.": "Votre compte __username__@__domain__ a été créé avec succès.", - "If you want to use your murena.io email in a mail app like Thunderbird, Outlook or another, please visit this page.": "Si vous souhaitez utiliser votre email murena.io dans une application de messagerie comme Thunderbird, Outlook ou autre, veuillez visiter cette page." + "If you want to use your murena.io email in a mail app like Thunderbird, Outlook or another, please visit this page.": "Si vous souhaitez utiliser votre email murena.io dans une application de messagerie comme Thunderbird, Outlook ou autre, veuillez visiter cette page.", + "Incorrect password length: Required length is 8 to 32":"ngueur de mot de passe incorrecte : La longueur requise est comprise entre 8 et 32" }, "pluralForm": "nplurals=2; plural=(n != 1);" } diff --git a/l10n/it.js b/l10n/it.js index 008a8d01c31d18ecb1250f8c747a57dda5159aec..c0a1df6429bd6c77690a40c39a32b7fa77e01b1e 100644 --- a/l10n/it.js +++ b/l10n/it.js @@ -74,6 +74,7 @@ OC.L10N.register( "I have read and accept the Terms of Service.": "Ho letto e accetto i Termini di servizio.", "Success!": "Successo!", "Your __username__@__domain__ account was successfully created.": "L'account __username__@__domain__ è stato creato con successo.", - "If you want to use your murena.io email in a mail app like Thunderbird, Outlook or another, please visit this page.": "Se si desidera utilizzare l'e-mail di murena.io in un'applicazione di posta elettronica come Thunderbird, Outlook o altre, visitare questa pagina." + "If you want to use your murena.io email in a mail app like Thunderbird, Outlook or another, please visit this page.": "Se si desidera utilizzare l'e-mail di murena.io in un'applicazione di posta elettronica come Thunderbird, Outlook o altre, visitare questa pagina.", + "Incorrect password length: Required length is 8 to 32":"Lunghezza della password errata: La lunghezza richiesta è da 8 a 32" }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/it.json b/l10n/it.json index 2dcaf6c59748bdfdf8ede6ab443109a6bbd821a6..82634b233a01e154c7ac8feda50f6ceb1b55da8f 100644 --- a/l10n/it.json +++ b/l10n/it.json @@ -68,7 +68,9 @@ "Human Verification is required.": "È necessaria la verifica umana.", "Human Verification code is not correct.": "Il codice di verifica umano non è corretto.", "Recovery Email is required.": "L'e-mail di recupero è necessaria.", - "You must read and accept the Terms of Service to create your account.": "Per creare il proprio account è necessario leggere e accettare i Termini di servizio." + "You must read and accept the Terms of Service to create your account.": "Per creare il proprio account è necessario leggere e accettare i Termini di servizio.", + "If you want to use your murena.io email in a mail app like Thunderbird, Outlook or another, please visit this page.": "Se si desidera utilizzare l'e-mail di murena.io in un'applicazione di posta elettronica come Thunderbird, Outlook o altre, visitare questa pagina.", + "Incorrect password length: Required length is 8 to 32":"Lunghezza della password errata: La lunghezza richiesta è da 8 a 32" }, "pluralForm": "nplurals=2; plural=(n != 1);" } diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 890b535549bb043f6a7b7e1095bca05b76e23d05..b8070465d5c11e80df3760907ac67895b20ae08c 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -26,6 +26,7 @@ declare(strict_types=1); namespace OCA\EcloudAccounts\AppInfo; +use OCA\EcloudAccounts\Listeners\BeforeTemplateRenderedListener; use OCA\EcloudAccounts\Listeners\BeforeUserDeletedListener; use OCA\EcloudAccounts\Listeners\TwoFactorStateChangedListener; use OCA\EcloudAccounts\Listeners\UserChangedListener; @@ -35,6 +36,7 @@ use OCP\AppFramework\App; use OCP\AppFramework\Bootstrap\IBootContext; use OCP\AppFramework\Bootstrap\IBootstrap; use OCP\AppFramework\Bootstrap\IRegistrationContext; +use OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent; use OCP\IUserManager; use OCP\User\Events\BeforeUserDeletedEvent; use OCP\User\Events\UserChangedEvent; @@ -47,6 +49,7 @@ class Application extends App implements IBootstrap { } public function register(IRegistrationContext $context): void { + $context->registerEventListener(BeforeTemplateRenderedEvent::class, BeforeTemplateRenderedListener::class); $context->registerEventListener(BeforeUserDeletedEvent::class, BeforeUserDeletedListener::class); $context->registerEventListener(UserChangedEvent::class, UserChangedListener::class); $context->registerEventListener(StateChanged::class, TwoFactorStateChangedListener::class); diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index 9bbebb5f1e43e4f4055ace45efbf3e8d33515b0c..663bde760ee071a9224a505dd033342ae7a67909 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -75,6 +75,7 @@ class AccountController extends Controller { TemplateResponse::RENDER_AS_GUEST ); } + /** * @NoAdminRequired * @PublicPage @@ -126,7 +127,7 @@ class AccountController extends Controller { $this->userService->setUserLanguage($username, $language); if($recoveryEmail !== '') { - $this->userService->setRecoveryEmail($username, $recoveryEmail); + $this->userService->setUnverifiedRecoveryEmail($username, $recoveryEmail); } $this->userService->sendWelcomeEmail($displayname, $username, $userEmail, $language); diff --git a/lib/Controller/UserController.php b/lib/Controller/UserController.php index 1d0745d6cb3f1468c2a00bb73a6aff4e01a8d2f0..9871ba506647b8c17edd80d8f6c81013569b75d9 100644 --- a/lib/Controller/UserController.php +++ b/lib/Controller/UserController.php @@ -94,10 +94,7 @@ class UserController extends ApiController { } // $this->userService->sendWelcomeEmail($uid, $email); $this->config->setUserValue($uid, 'terms_of_service', 'tosAccepted', intval($tosAccepted)); - $recoveryEmailUpdated = $this->userService->setRecoveryEmail($uid, $recoveryEmail); - if (!$recoveryEmailUpdated) { - return $this->getErrorResponse($response, 'error_setting_recovery', 400); - } + $this->userService->setRecoveryEmail($uid, $recoveryEmail); $hmeAliasAdded = $this->userService->addHMEAliasInConfig($uid, $hmeAlias); if (!$hmeAliasAdded) { return $this->getErrorResponse($response, 'error_adding_hme_alias', 400); diff --git a/lib/Listeners/BeforeTemplateRenderedListener.php b/lib/Listeners/BeforeTemplateRenderedListener.php index 86b5f99b5b704f684ecab0e7717dfd2b185b290c..adece9c3c691e046cc4b562afef4d6accca6be81 100644 --- a/lib/Listeners/BeforeTemplateRenderedListener.php +++ b/lib/Listeners/BeforeTemplateRenderedListener.php @@ -4,14 +4,15 @@ declare(strict_types=1); namespace OCA\EcloudAccounts\Listeners; -use \OCP\EventDispatcher\IEventListener; use OCP\App\IAppManager; use OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent; use OCP\EventDispatcher\Event; +use OCP\EventDispatcher\IEventListener; use OCP\IConfig; use OCP\IRequest; use OCP\ISession; use OCP\IUserSession; +use OCP\Util; class BeforeTemplateRenderedListener implements IEventListener { private $userSession; @@ -20,18 +21,20 @@ class BeforeTemplateRenderedListener implements IEventListener { private $session; private $config; private $appManager; + private Util $util; private const SNAPPYMAIL_APP_ID = 'snappymail'; private const SNAPPYMAIL_URL = '/apps/snappymail/'; private const SNAPPYMAIL_AUTOLOGIN_PWD = '1'; - public function __construct($appName, IUserSession $userSession, IRequest $request, ISession $session, IConfig $config, IAppManager $appManager) { + public function __construct($appName, IUserSession $userSession, IRequest $request, ISession $session, IConfig $config, IAppManager $appManager, Util $util) { $this->appName = $appName; $this->userSession = $userSession; $this->request = $request; $this->session = $session; $this->config = $config; $this->appManager = $appManager; + $this->util = $util; } public function handle(Event $event): void { @@ -41,6 +44,12 @@ class BeforeTemplateRenderedListener implements IEventListener { if ($this->userSession->isLoggedIn() && $this->appManager->isEnabledForUser(self::SNAPPYMAIL_APP_ID) && strpos($this->request->getPathInfo(), self::SNAPPYMAIL_URL) !== false) { $this->autoLoginWebmail(); } + $pathInfo = $this->request->getPathInfo(); + + if (strpos($pathInfo, '/apps/ecloud-accounts/accounts') !== false) { + $this->util->addStyle($this->appName, $this->appName . '-userregistration'); + } + } @@ -51,11 +60,11 @@ class BeforeTemplateRenderedListener implements IEventListener { } $accountId = $this->getAccountId(); $actions = \RainLoop\Api::Actions(); - + if (empty($accountId) || $actions->getMainAccountFromToken(false)) { return; } - + // Just send over '1' as password to trigger login as the plugin will set the correct access token $password = self::SNAPPYMAIL_AUTOLOGIN_PWD; // As we cannot pass by reference to LoginProcess $account = $actions->LoginProcess($accountId, $password, false); @@ -65,7 +74,7 @@ class BeforeTemplateRenderedListener implements IEventListener { } } - private function getAccountId() : string { + private function getAccountId(): string { $username = $this->userSession->getUser()->getUID(); if ($this->config->getAppValue('snappymail', 'snappymail-autologin', false)) { return $username; diff --git a/lib/Service/UserService.php b/lib/Service/UserService.php index 56e156fe925dda9306aec3250bf72393f04a1e2b..f35b6e6e3d5c59806c85afd844e35908bcc8d07e 100644 --- a/lib/Service/UserService.php +++ b/lib/Service/UserService.php @@ -95,6 +95,9 @@ class UserService { public function setRecoveryEmail(string $uid, string $recoveryEmail): void { $this->config->setUserValue($uid, 'email-recovery', 'recovery-email', $recoveryEmail); } + public function setUnverifiedRecoveryEmail(string $uid, string $recoveryEmail): void { + $this->config->setUserValue($uid, 'email-recovery', 'unverified-recovery-email', $recoveryEmail); + } public function setTOS(string $uid, bool $tosAccepted): void { $this->config->setUserValue($uid, 'terms_of_service', 'tosAccepted', intval($tosAccepted)); } @@ -197,6 +200,7 @@ class UserService { public function setUserLanguage(string $username, string $language = 'en') { $this->config->setUserValue($username, 'core', 'lang', $language); } + private function createSendGridEmail(string $fromEmail, string $fromName, string $username, string $displayname, string $userEmail, string $templateID) : \SendGrid\Mail\Mail { $mainDomain = $this->getMainDomain(); diff --git a/src/signup/RegistrationForm.vue b/src/signup/RegistrationForm.vue index 38faebc25cf994be149da6b5cf2db6fe693b5fa8..3a5f091be282a97fd2f467fa6a1ef26bde636aa8 100644 --- a/src/signup/RegistrationForm.vue +++ b/src/signup/RegistrationForm.vue @@ -1,17 +1,17 @@