diff --git a/css/ecloud-accounts-userregistration.css b/css/ecloud-accounts-userregistration.css deleted file mode 100644 index 895b680cfd099b06ed8d82e311bbe6d386669cba..0000000000000000000000000000000000000000 --- a/css/ecloud-accounts-userregistration.css +++ /dev/null @@ -1,46 +0,0 @@ -html { - background: var(--color-main-background); -} - -#body-login .warning-messsage { - width: 100% !important; -} - -#body-login .v-align { - align-items: flex-start !important; - justify-content: flex-start !important; -} - -.v-align header { - width: 100% !important; - display: flex !important; - align-items: flex-start !important; - justify-content: flex-start !important; -} - -#header { - padding-left: 5% !important; -} - -.v-align main { - width: 50% !important; - margin: 0 auto; -} - -.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/warning.svg b/img/warning.svg new file mode 100644 index 0000000000000000000000000000000000000000..704197c70da341ac90ed4b5b0f2221cafaab95a1 --- /dev/null +++ b/img/warning.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/l10n/de.js b/l10n/de.js index 2c564a7494433f2063874429452f30e092f07bb5..62f0a6d986475a2ff58d509a2df3ec1a1a5137b2 100644 --- a/l10n/de.js +++ b/l10n/de.js @@ -73,6 +73,8 @@ 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.", + "Please set your recovery email address to use your email account without restrictions.": "Bitte geben Sie Ihre Wiederherstellungs-E-Mail-Adresse an, damit Sie Ihr E-Mail ohne Beschränkungen nutzen können.", + "SET RECOVERY EMAIL NOW": "MEINE WIEDERHERSTELLUNGS-E-MAIL-ADRESSE ANGEBEN", "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" }, diff --git a/l10n/de.json b/l10n/de.json index fdc003d311e1ff1dcba0d4939ffcc91d5b1ff290..01c29cc78efceeb128a13a7a8d98ab7059b32aab 100644 --- a/l10n/de.json +++ b/l10n/de.json @@ -72,6 +72,8 @@ "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.", + "Please set your recovery email address to use your email account without restrictions.": "Bitte geben Sie Ihre Wiederherstellungs-E-Mail-Adresse an, damit Sie Ihr E-Mail ohne Beschränkungen nutzen können.", + "SET RECOVERY EMAIL NOW": "MEINE WIEDERHERSTELLUNGS-E-MAIL-ADRESSE ANGEBEN", "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 9cb3afc8c5e2a3c581d8306e0b9ba978d1b29007..934a7cd9656bae2b90f8bbcdfbd77dac0e360523 100644 --- a/l10n/en.js +++ b/l10n/en.js @@ -76,6 +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.", + "Please set your recovery email address to use your email account without restrictions.": "Please set your recovery email address to use your email account without restrictions.", + "SET RECOVERY EMAIL NOW": "SET RECOVERY EMAIL NOW", "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" diff --git a/l10n/en.json b/l10n/en.json index eb5fac3a7e05d9a8517145a0934c04b989563a5f..0978cc04ea81d1f89fc3d38ef69a7e6e6c3d2a7a 100644 --- a/l10n/en.json +++ b/l10n/en.json @@ -74,6 +74,8 @@ "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.", + "Please set your recovery email address to use your email account without restrictions.": "Please set your recovery email address to use your email account without restrictions.", + "SET RECOVERY EMAIL NOW": "SET RECOVERY EMAIL NOW", "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 f4f64e8ecaf936cecc2686fffcdd8a0163c86b8d..c440bda59f12e4c4106a6a90392bc5b85b27bd95 100644 --- a/l10n/es.js +++ b/l10n/es.js @@ -75,6 +75,8 @@ 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.", + "Please set your recovery email address to use your email account without restrictions.": "Configura tu dirección de correo electrónico de recuperación para utilizar tu cuenta de correo electrónico sin restricciones.", + "SET RECOVERY EMAIL NOW": "CONFIGURAR CORREO ELECTRÓNICO DE RECUPERACIÓN", "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" }, diff --git a/l10n/es.json b/l10n/es.json index eee55840d777d09d68d347aff185241ec71716ae..e357916e8f8f17b8f749c9c862928bf40bfcc75b 100644 --- a/l10n/es.json +++ b/l10n/es.json @@ -74,6 +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.", + "Please set your recovery email address to use your email account without restrictions.": "Configura tu dirección de correo electrónico de recuperación para utilizar tu cuenta de correo electrónico sin restricciones.", + "SET RECOVERY EMAIL NOW": "CONFIGURAR CORREO ELECTRÓNICO DE RECUPERACIÓN", "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" }, diff --git a/l10n/fr.js b/l10n/fr.js index dea43d8d118fc09a6dfc2b292bf25ac129c06ec4..6da658e4e3a10dc6ac1b80f147d3fc908bf68127 100644 --- a/l10n/fr.js +++ b/l10n/fr.js @@ -74,6 +74,8 @@ 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.", + "Please set your recovery email address to use your email account without restrictions.": "Merci de définir une adresse e-mail de récupération pour bénéficier d'un usage de votre compte sans restrictions.", + "SET RECOVERY EMAIL NOW": "DEFINIR L'ADRESSE DE RECUPERATION MAINTENANT", "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" }, diff --git a/l10n/fr.json b/l10n/fr.json index e733fab18b8cc2a7a9c17fc8f8620d89650fd3d8..feae2935652fa97caf27d8bdd2aa00c59cbf4f80 100644 --- a/l10n/fr.json +++ b/l10n/fr.json @@ -73,6 +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.", + "Please set your recovery email address to use your email account without restrictions.": "Merci de définir une adresse e-mail de récupération pour bénéficier d'un usage de votre compte sans restrictions.", + "SET RECOVERY EMAIL NOW": "DEFINIR L'ADRESSE DE RECUPERATION MAINTENANT", "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" }, diff --git a/l10n/it.js b/l10n/it.js index c0a1df6429bd6c77690a40c39a32b7fa77e01b1e..a14e1948739f22069ca896d5a1bf256f886868b7 100644 --- a/l10n/it.js +++ b/l10n/it.js @@ -74,6 +74,8 @@ 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.", + "Please set your recovery email address to use your email account without restrictions.": "Per poter usare l'account email senza restrizioni devi impostare l'indirizzo email di recovery.", + "SET RECOVERY EMAIL NOW": "IMPOSTA ADESSO LA EMAIL DI RECOVERY", "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" }, diff --git a/l10n/it.json b/l10n/it.json index 82634b233a01e154c7ac8feda50f6ceb1b55da8f..1447d493d4b2c9049bec57c4e69c887b68a639ce 100644 --- a/l10n/it.json +++ b/l10n/it.json @@ -69,6 +69,8 @@ "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.", + "Please set your recovery email address to use your email account without restrictions.": "Per poter usare l'account email senza restrizioni devi impostare l'indirizzo email di recovery.", + "SET RECOVERY EMAIL NOW": "IMPOSTA ADESSO LA EMAIL DI RECOVERY", "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" }, diff --git a/lib/Listeners/BeforeTemplateRenderedListener.php b/lib/Listeners/BeforeTemplateRenderedListener.php index adece9c3c691e046cc4b562afef4d6accca6be81..4e6ee30162e074a6d267d1db01af2ad557292bf3 100644 --- a/lib/Listeners/BeforeTemplateRenderedListener.php +++ b/lib/Listeners/BeforeTemplateRenderedListener.php @@ -11,6 +11,7 @@ use OCP\EventDispatcher\IEventListener; use OCP\IConfig; use OCP\IRequest; use OCP\ISession; +use OCP\IUser; use OCP\IUserSession; use OCP\Util; @@ -44,10 +45,22 @@ 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(); } + if ($this->userSession->isLoggedIn()) { + $user = $this->userSession->getUser(); + if ($user instanceof IUser) { + $userID = $user->getUID(); + $recoveryEmail = $this->config->getUserValue($userID, 'email-recovery', 'recovery-email', ''); + if($recoveryEmail === '') { + $this->util->addStyle($this->appName, $this->appName . '-email-recovery'); + $this->util->addScript($this->appName, $this->appName . '-email-recovery'); + } + } + } + $pathInfo = $this->request->getPathInfo(); if (strpos($pathInfo, '/apps/ecloud-accounts/accounts') !== false) { - $this->util->addStyle($this->appName, $this->appName . '-userregistration'); + $this->util->addStyle($this->appName, $this->appName . '-user-registration'); } } diff --git a/package.json b/package.json index 74dc503cdd9b43742dab1ccd8b6da31a74f6dcb2..38b720072bf078bf858793f238f71361c5c0fc7e 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,9 @@ }, "private": true, "scripts": { - "build": "NODE_ENV=production webpack --progress", - "dev": "NODE_ENV=development webpack --progress", + "build-scss": "sass scss:css --style compressed --no-source-map", + "build": "npm run build-scss && NODE_ENV=production webpack --progress", + "dev": "npm run build-scss && NODE_ENV=development webpack --progress", "watch": "NODE_ENV=development webpack --progress --watch", "lint": "eslint --ext .js,.vue src", "lint:fix": "eslint --ext .js,.vue src --fix", diff --git a/scss/ecloud-accounts-email-recovery.scss b/scss/ecloud-accounts-email-recovery.scss new file mode 100644 index 0000000000000000000000000000000000000000..162bce02a48f2f4d5f4a8d82796c41b40f7edc76 --- /dev/null +++ b/scss/ecloud-accounts-email-recovery.scss @@ -0,0 +1,74 @@ +.recovery-email { + display: inline-flex; + position: absolute; + top: 0px; + width: 100%; + z-index: 1000; + min-height: 50px; + box-sizing: border-box; + justify-content: center; + align-items: center; + background: #333333; + color: #ffffff; + font-size: 16px; + font-weight: 400; + line-height: 24px; + #image-text-container{ + display:inline-flex; + img { + padding-right:10px; + align-self: start; + } + } + + a { + color: #ffffff; + padding-left: 24px; + text-decoration: underline; + font-size: 16px; + font-weight: 600; + } + +} + +#body-user #header, +#body-settings #header, +#body-public #header { + top: 50px !important; +} + +#content { + margin-top: 100px !important; + height: calc(100% - env(safe-area-inset-bottom) - 100px - var(--body-container-margin)) !important; + + @media only screen and (max-width: 480px) { + margin-top: 150px !important; + height: calc(100% - env(safe-area-inset-bottom) - 150px - var(--body-container-margin)) !important; + } + + @media only screen and (min-width: 481px) and (max-width: 768px) { + margin-top: 125px !important; + height: calc(100% - env(safe-area-inset-bottom) - 125px - var(--body-container-margin)) !important; + } +} +@media only screen and (max-width: 1024px) { + #body-user #header, + #body-settings #header, + #body-public #header { + top: 90px !important; + } +} +@media only screen and (max-width: 768px) { + .recovery-email { + display: block; + padding: 16px 7%; + a{ + padding: 8px 0 0 30px; + } + } + #body-user #header, + #body-settings #header, + #body-public #header { + top: 120px !important; + } +} diff --git a/scss/ecloud-accounts-user-registration.scss b/scss/ecloud-accounts-user-registration.scss new file mode 100644 index 0000000000000000000000000000000000000000..187e81e572a4c864a3d973aef63d422da33f34e1 --- /dev/null +++ b/scss/ecloud-accounts-user-registration.scss @@ -0,0 +1,65 @@ +html { + background: var(--color-main-background); +} + +#body-login { + .warning-messsage { + width: 100% !important; + } + + .v-align { + align-items: flex-start !important; + justify-content: flex-start !important; + + header { + width: 100% !important; + display: flex !important; + align-items: flex-start !important; + justify-content: flex-start !important; + } + + main { + width: 50% !important; + margin: 0 auto; + } + + @media only screen and (max-width: 768px) { + padding: 5vh 0vh !important; + + main { + width: 100% !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; + } + } +} + +#fields-password { + .Password__strength-meter { + margin-bottom: 0; + } +} diff --git a/src/emailrecovery.js b/src/emailrecovery.js new file mode 100644 index 0000000000000000000000000000000000000000..4d34cf2b017aa88472f15ee33939b830329e3fd0 --- /dev/null +++ b/src/emailrecovery.js @@ -0,0 +1,69 @@ +import { generateUrl } from '@nextcloud/router' +const APPLICATION_NAME = 'ecloud-accounts' +document.addEventListener('DOMContentLoaded', function() { + const newDiv = createNewDiv('recovery-email') + const contentDiv = document.createElement('div') + contentDiv.id = 'image-text-container' + const img = createImageElement(APPLICATION_NAME) + const textNode = createTextNode(APPLICATION_NAME) + const link = createLinkElement(APPLICATION_NAME) + + contentDiv.appendChild(img) + contentDiv.appendChild(textNode) + newDiv.appendChild(contentDiv) + newDiv.appendChild(link) + insertIntoDOM(newDiv) +}) + +/** + * + * @param className + */ +function createNewDiv(className) { + const div = document.createElement('div') + div.className = className + return div +} + +/** + * + * @param appName + */ +function createImageElement(appName) { + const img = document.createElement('img') + img.src = generateUrl('/custom_apps/' + appName + '/img/warning.svg') + return img +} + +/** + * + * @param appName + */ +function createTextNode(appName) { + const p = document.createElement('p') + const text = document.createTextNode(t(appName, 'Please set your recovery email address to use your email account without restrictions.')) + p.appendChild(text) + return p +} + +/** + * + * @param appName + */ +function createLinkElement(appName) { + const link = document.createElement('a') + link.textContent = t(appName, 'SET RECOVERY EMAIL NOW') + link.href = OC.getRootPath() + '/settings/user/security#recovery-email-div' + link.style.display = 'block' + return link +} + +/** + * + * @param element + */ +function insertIntoDOM(element) { + const targetElement = document.getElementById('header') + const parentElement = targetElement.parentNode + parentElement.insertBefore(element, targetElement) +} diff --git a/webpack.config.js b/webpack.config.js index b6eaacbad759d6b97381556dbaa35e18123dbeca..db72711087270e3e9f2d584cfdd903444f9c0d18 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -9,6 +9,7 @@ module.exports = { 'delete-shop-account-setting': path.join(__dirname, 'src/delete-shop-account-setting.js'), 'delete-account-listeners': path.join(__dirname, 'src/delete-account-listeners.js'), 'beta-user-setting': path.join(__dirname, 'src/beta-user-setting.js'), - 'signup': path.join(__dirname, 'src/signup.js') + 'signup': path.join(__dirname, 'src/signup.js'), + 'email-recovery': path.join(__dirname, 'src/emailrecovery.js') }, }