From b4cb43e071cea22094e5c76541fd7aadbf6742e0 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 8 Aug 2023 04:58:44 -0700 Subject: [PATCH 001/211] Signup page --- appinfo/routes.php | 3 +- lib/Controller/AccountController.php | 42 ++++++++++++++++++++++++++++ lib/Service/AccountService.php | 30 ++++++++++++++++++++ 3 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 lib/Controller/AccountController.php create mode 100644 lib/Service/AccountService.php diff --git a/appinfo/routes.php b/appinfo/routes.php index aedd9131..717a5eae 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -23,5 +23,6 @@ return ['routes' => [ [ 'name' => 'beta_user#submit_issue', 'url' => '/issue/submit', 'verb' => 'POST' - ] + ], + ['name' => 'account#index', 'url' => '/account/signup', 'verb' => 'GET'], ]]; diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php new file mode 100644 index 00000000..f36f1de3 --- /dev/null +++ b/lib/Controller/AccountController.php @@ -0,0 +1,42 @@ +appName = $AppName; + } + + /** + * @PublicPage + * @NoCSRFRequired + * + */ + public function index() { + echo 'index page'; die; + return true; + } + /** + * @PublicPage + * @NoCSRFRequired + * + */ + public function signup() { + echo 'signup page'; die; + return true; + } +} diff --git a/lib/Service/AccountService.php b/lib/Service/AccountService.php new file mode 100644 index 00000000..e084139e --- /dev/null +++ b/lib/Service/AccountService.php @@ -0,0 +1,30 @@ +config = $config; + $this->groupManager = $groupManager; + $this->userSession = $userSession; + $this->appManager = $appManager; + } + +} -- GitLab From 6749ce612c14a2c28264ba82206028dfe9611e81 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 8 Aug 2023 11:34:05 -0700 Subject: [PATCH 002/211] signup page added --- lib/Controller/AccountController.php | 23 +- scss/signup.scss | 487 +++++++++++++++++++++++++++ src/Signup.vue | 260 ++++++++++++++ src/signup.js | 8 + templates/signup.php | 4 + webpack.config.js | 1 + 6 files changed, 772 insertions(+), 11 deletions(-) create mode 100644 scss/signup.scss create mode 100644 src/Signup.vue create mode 100644 src/signup.js create mode 100644 templates/signup.php diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index f36f1de3..51cfa09d 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -8,6 +8,10 @@ namespace OCA\EcloudAccounts\Controller; use OCP\AppFramework\Controller; use OCP\IRequest; +use OCP\AppFramework\Http\TemplateResponse; +use OC_App; +use OCA\EcloudAccounts\AppInfo\Application; + class AccountController extends Controller { protected $appName; @@ -22,21 +26,18 @@ class AccountController extends Controller { } /** + * @NoAdminRequired * @PublicPage * @NoCSRFRequired * */ public function index() { - echo 'index page'; die; - return true; - } - /** - * @PublicPage - * @NoCSRFRequired - * - */ - public function signup() { - echo 'signup page'; die; - return true; + return new TemplateResponse( + Application::APP_ID, + 'signup', + ['appName' => Application::APP_ID], + TemplateResponse::RENDER_AS_GUEST + ); } + } diff --git a/scss/signup.scss b/scss/signup.scss new file mode 100644 index 00000000..bbf20c14 --- /dev/null +++ b/scss/signup.scss @@ -0,0 +1,487 @@ +/** mobile font sizes **/ +@media screen and (max-width: 650px) { + #footer { + font-size: 0.8em; + } + + #fields .field .control input { + padding-left: 2%; + padding-right: 2%; + } + + #main { + margin-top: 8%; + } +} + +@media screen and (max-width: 768px) { + button { + font-size: 1.0em; + } + + #successMessages { + margin-left: 5%; + margin-right: 5%; + } + + #success h1 { + font-size: 1.5em; + } + + .lang-dropdown-div { + padding-right: 4%; + } + + #inviteHeader, + #registerHeading { + font-size: 1.5em; + } + + #fields { + font-size: 0; + background-color: white; + } + + #fields .field { + font-size: 1.0em; + } + + #fields .field .control input { + font-size: 1.0em; + line-height: 1.0em; + } + + #fields p { + font-size: 1.0em; + } + + input { + font-size: 1.0em; + line-height: 1.0em; + } + + #footer { + display: flex; + flex-direction: column; + position: unset !important; + } + + #main { + max-width: 100%; + padding: 10%; + } +} + +#body-login, +#body-login a, +#body-login p { + background-color: #ffffff; + color: #808080; + font-family: "Montserrat"; +} + +.isa_info, +.isa_success, +.isa_warning, +.isa_error { + margin: 10px 0px; + padding: 12px; + font-family: "Montserrat"; +} + +.isa_info { + color: #00529b; + background-color: #bde5f8; +} + +.isa_success { + color: rgba(0, 0, 0, 0.6); + background-color: white; +} + +.isa_warning { + color: #9f6000; + background-color: #feefb3; +} + +.isa_error { + color: white; + background-color: #FF363F; + font-size: 14px; +} + +.e_logo_div { + text-align: center; + position: absolute; + left: 5%; + top: 5%; + max-width: 40%; +} + +.hint { + margin: 0.2em auto 0.3em; +} + +.isa_info i, +.isa_success i, +.isa_warning i, +.isa_error i { + margin: 10px 22px; + font-size: 1.5em; + vertical-align: middle; +} + +section { + width: 100%; + max-width: 40%; + margin-left: auto; + margin-right: auto; +} + +.button:disabled { + background-color: grey; + /* Grey */ +} + +/* input:hover, + input:focus { + outline: 0; + transition: all 0.5s linear; + box-shadow: inset 0px 0px 10px #ccc; + } */ +input[type="checkbox"] { + box-shadow: none; + width: 1.5rem; + margin-right: 0.5rem; +} + +#password-strength-meter { + height: 15px; +} + +meter { + /* Reset the default appearance */ + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; + + margin: 0 auto 0.1em; + width: 100%; + height: 0.5em; + + /* Applicable only to Firefox */ + background: none; + background-color: rgba(54, 47, 47, 0.1); +} + +meter::-webkit-meter-bar { + background: none; + background-color: rgba(54, 47, 47, 0.1); +} + +meter[value="1"]::-webkit-meter-optimum-value { + background: #f6bb97; +} + +meter[value="2"]::-webkit-meter-optimum-value { + background: #ffddca; +} + +meter[value="3"]::-webkit-meter-optimum-value { + background: #ffddca; +} + +meter[value="4"]::-webkit-meter-optimum-value { + background: #a0e6bb; +} + +meter[value="1"]::-moz-meter-bar { + background: #f6bb97; +} + +meter[value="2"]::-moz-meter-bar { + background: #ffddca; +} + +meter[value="3"]::-moz-meter-bar { + background: #ffddca; +} + +meter[value="4"]::-moz-meter-bar { + background: #a0e6bb; +} + +.feedback { + color: #fff; + font-size: 90%; + padding: 0 0.25em; + font-family: Arial, cursive; + margin-top: 1em; +} + +#footer { + background-color: #ffffff; + font-size: 14px; + width: 100%; + height: 100px; +} + +#langButton { + border: none; + padding: 0; + background-color: #ffffff; +} + +#icon-down { + color: blue; + padding-top: 10%; +} + +.button-primary { + background-color: #007fff; + color: white; + width: 100%; + padding: 22px 0; + margin-top: 1em; + margin-bottom: 1em; +} + +.button-primary:hover { + color: white; +} + +.button-primary:disabled { + background-color: #007fff; + color: white; + border-radius: 290486px; + padding-left: calc(1em + 0.25em); + padding-right: calc(1em + 0.25em); +} + +.button-primary .button-text { + text-overflow: ellipsis; + overflow: hidden; + font-weight: 700; +} + +#buttonField { + clear: left; +} + +#buttonField .control { + width: 100%; +} + +button { + font-size: 20px; +} + +#fields { + font-size: 0; + background-color: white; +} + +#fields .field { + font-size: 1.3em; +} + +#fields p { + font-size: 15px; +} + +input { + color: rgba(0, 0, 0, 0.8); + background-color: white; + display: block; + width: 100%; + font-size: 16px; + line-height: 1.3em; + transition: all 0.5s linear; + border: 1px solid #E6E8E9; + border-radius: 8px; + padding: 10px 20px; + margin-top: 10px; + margin-bottom: 20px; +} + +#captcha_img { + font-size: 12px; + width: 100%; +} + +.lang-dropdown-div { + float: right; + margin-top: 2%; + margin-right: 2%; +} + +#lang-dropdown-menu { + right: auto; +} + +#inviteHeader, +#registerHeading { + margin-bottom: 10%; + font-size: 24px; + text-align: left !important; + font-weight: 500; +} + +.lang-dropdown-item { + text-align: center; + display: flex; + justify-content: center; + padding-right: 1rem !important; +} + +.dropdown-content { + max-width: max-content; +} + +#currentLangImg, +.lang-image { + border-radius: 50%; + margin: 0 auto; + border: 0.1em transparent black; + height: 24px; + width: 24px; + max-width: none; +} + +#submitButton:hover { + opacity: 0.9; +} + +.wrong-icon, +.correct-icon, +.notification-text { + vertical-align: middle; +} + +.correct-icon, +.wrong-icon { + padding-left: 3%; + padding-right: 5%; +} + +#main { + width: 100%; +} + +.container { + height: 100vh; + max-width: unset !important; +} + +#fields label { + color: #333333; + font-size: 16px; + font-weight: 900; +} + +#inviteRequestForm .image { + float: left; + width: auto; +} + +.captcha_img_div { + height: 50px; +} + +.pad-left-5 { + padding-top: 3%; + padding-left: 5%; +} + +.domain-username { + display: flex; +} + +#repassword { + width: 48%; + margin-left: 4%; +} + +#password { + width: 48%; +} + +#username { + width: 70%; +} + +.email-invite-page .fa-check { + display: none; +} + +#success { + margin-top: -20%; + max-width: 100%; +} + +.success__title { + font-family: 'Montserrat'; + font-style: normal; + font-weight: 700; + font-size: 24px; + line-height: 150%; + margin: 1em 0 0.5em 0; + text-align: center; +} + +.notification a:not(.button):not(.dropdown-item) { + color: #0086FF; + text-decoration: none; +} + +sup { + color: #ff0000; + font-weight: 500; + font-size: 14px; + padding-left: 3px; +} + +#tos_div label { + line-height: 1.5rem; +} + +@media screen and (max-width: 500px) { + #main { + padding: 0 1.5rem; + } + + .lang-dropdown-div { + margin-top: 10%; + } + + .e_logo_div, + .lang-dropdown-div { + position: unset; + max-width: 100%; + padding: 2%; + float: none; + margin-top: unset; + text-align: center; + } + + #inviteHeader, + #registerHeading { + font-size: 18px; + } + + footer p { + font-size: 10px; + } +} + +.welcome-header { + height: 100px; + padding-top: 5px; +} + +.welcome-container { + min-height: 100vh; + display: flex; + flex-direction: column; + justify-content: space-between; +} \ No newline at end of file diff --git a/src/Signup.vue b/src/Signup.vue new file mode 100644 index 00000000..8763159d --- /dev/null +++ b/src/Signup.vue @@ -0,0 +1,260 @@ + + + + diff --git a/src/signup.js b/src/signup.js new file mode 100644 index 00000000..591ad0f5 --- /dev/null +++ b/src/signup.js @@ -0,0 +1,8 @@ +import Vue from 'vue' +import './common.js' +import Signup from './Signup.vue' + +export default new Vue({ + el: '#ecloud-accounts-signup', + render: h => h(Signup), +}) diff --git a/templates/signup.php b/templates/signup.php new file mode 100644 index 00000000..95f0ce04 --- /dev/null +++ b/templates/signup.php @@ -0,0 +1,4 @@ + +
\ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js index b2b5fbb0..c5e35203 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -9,5 +9,6 @@ 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'), }, } -- GitLab From 06144efb128881fcbb6e4612d084339554343a50 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 8 Aug 2023 22:50:02 -0700 Subject: [PATCH 003/211] added translations --- l10n/de.js | 10 +++++++++- l10n/de.json | 10 +++++++++- l10n/en.js | 10 +++++++++- l10n/en.json | 10 +++++++++- l10n/es.js | 10 +++++++++- l10n/es.json | 10 +++++++++- l10n/fr.js | 10 +++++++++- l10n/fr.json | 9 ++++++++- l10n/it.js | 10 +++++++++- 9 files changed, 80 insertions(+), 9 deletions(-) diff --git a/l10n/de.js b/l10n/de.js index 47243d09..58003da2 100644 --- a/l10n/de.js +++ b/l10n/de.js @@ -39,7 +39,15 @@ OC.L10N.register( "A subscription is active in this account. Please cancel it or let it expire before deleting your account.": "Für dieses Konto ist ein Abonnement aktiv. Bitte kündigen Sie es oder lassen Sie es auslaufen, bevor Sie Ihr Konto löschen.", "Loading...": "Laden...", "Temporary error contacting murena.com; please try again later!": "Vorübergehender Fehler bei der Kontaktaufnahme mit murena.com; bitte versuchen Sie es später noch einmal!", - "Murena Cloud 2FA": "Murena Cloud 2FA" + "Murena Cloud 2FA": "Murena Cloud 2FA", + "Request Murena Account": "Anfrage für ein Murena Konto", + "Email": "E-Mail", + "Enter email to receive invitation": "Geben Sie Ihre E-Mail-Adresse an, um den Einladungslink zu erhalten", + "Email is required.": "E-Mail ist erforderlich.", + "Confirm email": "Bestätigungs-E-Mail", + "Verify your email address": "E-Mail-Adresse bestätigen", + "Confirm email is required.": "Bestätigung der E-Mail ist erforderlich.", + "Request Invitation": "Einladung anfordern" }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/de.json b/l10n/de.json index d70e6d9c..927d0bb3 100644 --- a/l10n/de.json +++ b/l10n/de.json @@ -38,7 +38,15 @@ "A subscription is active in this account. Please cancel it or let it expire before deleting your account.": "Für dieses Konto ist ein Abonnement aktiv. Bitte kündigen Sie es oder lassen Sie es auslaufen, bevor Sie Ihr Konto löschen.", "Loading...": "Laden...", "Temporary error contacting murena.com; please try again later!": "Vorübergehender Fehler bei der Kontaktaufnahme mit murena.com; bitte versuchen Sie es später noch einmal!", - "Murena Cloud 2FA": "Murena Cloud 2FA" + "Murena Cloud 2FA": "Murena Cloud 2FA", + "Request Murena Account": "Anfrage für ein Murena Konto", + "Email": "E-Mail", + "Enter email to receive invitation": "Geben Sie Ihre E-Mail-Adresse an, um den Einladungslink zu erhalten", + "Email is required.": "E-Mail ist erforderlich.", + "Confirm email": "Bestätigungs-E-Mail", + "Verify your email address": "E-Mail-Adresse bestätigen", + "Confirm email is required.": "Bestätigung der E-Mail ist erforderlich.", + "Request Invitation": "Einladung anfordern" }, "pluralForm": "nplurals=2; plural=(n != 1);" } diff --git a/l10n/en.js b/l10n/en.js index 422054cf..ce031c75 100644 --- a/l10n/en.js +++ b/l10n/en.js @@ -41,6 +41,14 @@ OC.L10N.register( "A subscription is active in this account. Please cancel it or let it expire before deleting your account.": "A subscription is active in this account. Please cancel it or let it expire before deleting your account.", "Loading...": "Loading...", "Temporary error contacting murena.com; please try again later!": "Temporary error contacting murena.com; please try again later!", - "Murena Cloud 2FA": "Murena Cloud 2FA" + "Murena Cloud 2FA": "Murena Cloud 2FA", + "Request Murena Account": "Request Murena Account", + "Email": "Email", + "Enter email to receive invitation": "Enter email to receive invitation", + "Email is required.": "Email is required.", + "Confirm email": "Confirm email", + "Verify your email address": "Verify your email address", + "Confirm email is required.": "Confirm email is required.", + "Request Invitation": "Request Invitation" }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/en.json b/l10n/en.json index 83db6b42..314725c5 100644 --- a/l10n/en.json +++ b/l10n/en.json @@ -38,7 +38,15 @@ "A subscription is active in this account. Please cancel it or let it expire before deleting your account.": "A subscription is active in this account. Please cancel it or let it expire before deleting your account.", "Loading...": "Loading...", "Temporary error contacting murena.com; please try again later!": "Temporary error contacting murena.com; please try again later!", - "Murena Cloud 2FA": "Murena Cloud 2FA" + "Murena Cloud 2FA": "Murena Cloud 2FA", + "Request Murena Account": "Request Murena Account", + "Email": "Email", + "Enter email to receive invitation": "Enter email to receive invitation", + "Email is required.": "Email is required.", + "Confirm email": "Confirm email", + "Verify your email address": "Verify your email address", + "Confirm email is required.": "Confirm email is required.", + "Request Invitation": "Request Invitation" }, "pluralForm": "nplurals=2; plural=(n != 1);" } diff --git a/l10n/es.js b/l10n/es.js index 3a081dd1..3a94b811 100644 --- a/l10n/es.js +++ b/l10n/es.js @@ -40,6 +40,14 @@ OC.L10N.register( "A subscription is active in this account. Please cancel it or let it expire before deleting your account.": "Hay una suscripción activa en esta cuenta. Por favor, cancélala o deja que expire antes de eliminar tu cuenta.", "Loading...": "Cargando...", "Temporary error contacting murena.com; please try again later!": "Error temporal al contactar con murena.com; ¡por favor, inténtalo más tarde!", - "Murena Cloud 2FA": "Nube Murena A2F" + "Murena Cloud 2FA": "Nube Murena A2F", + "Request Murena Account": "Solicitar una cuenta Murena", + "Email": "Email", + "Enter email to receive invitation": "Tu correo electrónico", + "Email is required.": "Correo electrónico obligatorio.", + "Confirm email": "Confirmar correo electrónico", + "Verify your email address": "Repite la dirección de correo electrónico", + "Confirm email is required.": "Confirmar correo electrónico.", + "Request Invitation": "Solicitar invitación" }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/es.json b/l10n/es.json index b8594865..86c96ebc 100644 --- a/l10n/es.json +++ b/l10n/es.json @@ -38,7 +38,15 @@ "A subscription is active in this account. Please cancel it or let it expire before deleting your account.": "Hay una suscripción activa en esta cuenta. Por favor, cancélala o deja que expire antes de eliminar tu cuenta.", "Loading...": "Cargando...", "Temporary error contacting murena.com; please try again later!": "Error temporal al contactar con murena.com; ¡por favor, inténtalo más tarde!", - "Murena Cloud 2FA": "Nube Murena A2F" + "Murena Cloud 2FA": "Nube Murena A2F", + "Request Murena Account": "Solicitar una cuenta Murena", + "Email": "Email", + "Enter email to receive invitation": "Tu correo electrónico", + "Email is required.": "Correo electrónico obligatorio.", + "Confirm email": "Confirmar correo electrónico", + "Verify your email address": "Repite la dirección de correo electrónico", + "Confirm email is required.": "Confirmar correo electrónico.", + "Request Invitation": "Solicitar invitación" }, "pluralForm": "nplurals=2; plural=(n != 1);" } diff --git a/l10n/fr.js b/l10n/fr.js index 1f668c1f..eee4851e 100644 --- a/l10n/fr.js +++ b/l10n/fr.js @@ -39,6 +39,14 @@ OC.L10N.register( "A subscription is active in this account. Please cancel it or let it expire before deleting your account.": "Un abonnement est actif dans ce compte. Veuillez l'annuler ou le laisser expirer avant de supprimer votre compte.", "Loading...": "Chargement...", "Temporary error contacting murena.com; please try again later!": "Erreur temporaire en contactant murena.com ; veuillez réessayer plus tard !", - "Murena Cloud 2FA": "Authentification à 2 facteurs Murena Cloud" + "Murena Cloud 2FA": "Authentification à 2 facteurs Murena Cloud", + "Request Murena Account": "Création d'un compte Murena", + "Email": "Email", + "Enter email to receive invitation": "Saisissez votre adresse e-mail pour recevoir l'invitation", + "Email is required.": "L'adresse électronique est requise.", + "Confirm email": "Confirmez votre email", + "Verify your email address": "Confirmez votre adresse e-mail", + "Confirm email is required.": "Confirmer l'email est nécessaire.", + "Request Invitation": "Demander une invitation" }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/fr.json b/l10n/fr.json index 48a79c47..294aeacb 100644 --- a/l10n/fr.json +++ b/l10n/fr.json @@ -38,7 +38,14 @@ "A subscription is active in this account. Please cancel it or let it expire before deleting your account.": "Un abonnement est actif dans ce compte. Veuillez l'annuler ou le laisser expirer avant de supprimer votre compte.", "Loading...": "Chargement...", "Temporary error contacting murena.com; please try again later!": "Erreur temporaire en contactant murena.com ; veuillez réessayer plus tard !", - "Murena Cloud 2FA": "Authentification à 2 facteurs Murena Cloud" + "Murena Cloud 2FA": "Authentification à 2 facteurs Murena Cloud", + "Email": "Email", + "Enter email to receive invitation": "Saisissez votre adresse e-mail pour recevoir l'invitation", + "Email is required.": "L'adresse électronique est requise.", + "Confirm email": "Confirmez votre email", + "Verify your email address": "Confirmez votre adresse e-mail", + "Confirm email is required.": "Confirmer l'email est nécessaire.", + "Request Invitation": "Demander une invitation" }, "pluralForm": "nplurals=2; plural=(n != 1);" } diff --git a/l10n/it.js b/l10n/it.js index 7dbe4434..77d51191 100644 --- a/l10n/it.js +++ b/l10n/it.js @@ -39,6 +39,14 @@ OC.L10N.register( "A subscription is active in this account. Please cancel it or let it expire before deleting your account.": "In questo account è attivo un abbonamento. Si prega di annullarlo o di lasciarlo scadere prima di cancellare l'account.", "Loading...": "Caricamento...", "Temporary error contacting murena.com; please try again later!": "Errore temporaneo nel contattare murena.com; riprova più tardi!", - "Murena Cloud 2FA": "Codice di Autenticazione a 2 Fattori Murena Cloud" + "Murena Cloud 2FA": "Codice di Autenticazione a 2 Fattori Murena Cloud", + "Request Murena Account": "Richiedi un Account Murena", + "Email": "Email", + "Enter email to receive invitation": "Inserisci l'email cui inviare l'invito", + "Email is required.": "L'e-mail è necessaria.", + "Confirm email": "Conferma email", + "Verify your email address": "Verifica l'indirizzo email", + "Confirm email is required.": "È necessario confermare l'e-mail.", + "Request Invitation": "Richiedi invito" }, "nplurals=2; plural=(n != 1);"); -- GitLab From 5242184fc47b91510ff170fa6ca013be603b31c6 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 8 Aug 2023 22:51:18 -0700 Subject: [PATCH 004/211] php lint --- lib/Controller/AccountController.php | 13 ++++----- lib/Service/AccountService.php | 1 - src/Signup.vue | 41 ++++++++++++++++------------ 3 files changed, 29 insertions(+), 26 deletions(-) diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index 51cfa09d..d2b24892 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -9,10 +9,8 @@ namespace OCA\EcloudAccounts\Controller; use OCP\AppFramework\Controller; use OCP\IRequest; use OCP\AppFramework\Http\TemplateResponse; -use OC_App; use OCA\EcloudAccounts\AppInfo\Application; - class AccountController extends Controller { protected $appName; protected $request; @@ -33,11 +31,10 @@ class AccountController extends Controller { */ public function index() { return new TemplateResponse( - Application::APP_ID, - 'signup', - ['appName' => Application::APP_ID], - TemplateResponse::RENDER_AS_GUEST - ); + Application::APP_ID, + 'signup', + ['appName' => Application::APP_ID], + TemplateResponse::RENDER_AS_GUEST + ); } - } diff --git a/lib/Service/AccountService.php b/lib/Service/AccountService.php index e084139e..c15a631e 100644 --- a/lib/Service/AccountService.php +++ b/lib/Service/AccountService.php @@ -26,5 +26,4 @@ class AccountService { $this->userSession = $userSession; $this->appManager = $appManager; } - } diff --git a/src/Signup.vue b/src/Signup.vue index 8763159d..7b9fac60 100644 --- a/src/Signup.vue +++ b/src/Signup.vue @@ -2,7 +2,7 @@
-

+

{{ getLocalizedText('Request Murena Account') }}

@@ -10,9 +10,13 @@
- -

+ +

{{ getLocalizedText('Email is required.') }}

@@ -22,11 +26,14 @@
-

+

{{ getLocalizedText('Confirm email is required.') }}

@@ -46,12 +53,12 @@ diff --git a/src/create-account.js b/src/create-account.js new file mode 100644 index 00000000..ddfac174 --- /dev/null +++ b/src/create-account.js @@ -0,0 +1,8 @@ +import Vue from 'vue' +import './common.js' +import Signup from './CreateAccount.vue' + +export default new Vue({ + el: '#ecloud-accounts-create-account', + render: h => h(Signup), +}) diff --git a/templates/create-account.php b/templates/create-account.php new file mode 100644 index 00000000..c5e0eb54 --- /dev/null +++ b/templates/create-account.php @@ -0,0 +1,4 @@ + +
\ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js index c5e35203..5070b126 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -10,5 +10,6 @@ module.exports = { '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'), + 'create-account': path.join(__dirname, 'src/create-account.js'), }, } -- GitLab From a9c49533634420db38a9d5b954e54de13725d0d8 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Sun, 20 Aug 2023 09:45:19 -0700 Subject: [PATCH 008/211] removed unncessary --- appinfo/routes.php | 2 +- lib/Controller/AccountController.php | 106 ++++++++- src/CreateAccount.vue | 316 --------------------------- src/Signup.vue | 134 ++++++++---- src/create-account.js | 8 - templates/create-account.php | 4 - webpack.config.js | 3 +- 7 files changed, 183 insertions(+), 390 deletions(-) delete mode 100644 src/CreateAccount.vue delete mode 100644 src/create-account.js delete mode 100644 templates/create-account.php diff --git a/appinfo/routes.php b/appinfo/routes.php index 5bb37f4f..36ae5574 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -25,5 +25,5 @@ return ['routes' => [ 'url' => '/issue/submit', 'verb' => 'POST' ], ['name' => 'account#index', 'url' => '/account/signup', 'verb' => 'GET'], - ['name' => 'account#create_account', 'url' => '/account/create-account', 'verb' => 'GET'], + // ['name' => 'account#recaptcha', 'url' => '/account/recaptcha', 'verb' => 'GET'], ]]; diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index d2a375a5..71e2f7d4 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -10,17 +10,23 @@ use OCP\AppFramework\Controller; use OCP\IRequest; use OCP\AppFramework\Http\TemplateResponse; use OCA\EcloudAccounts\AppInfo\Application; +use OCP\ISession; -class AccountController extends Controller { +class AccountController extends Controller +{ protected $appName; protected $request; + // private ISession $session; + public function __construct( $AppName, IRequest $request, + ISession $session ) { parent::__construct($AppName, $request); $this->appName = $AppName; + // $this->session = $session; } /** @@ -29,7 +35,8 @@ class AccountController extends Controller { * @NoCSRFRequired * */ - public function index() { + public function index() + { return new TemplateResponse( Application::APP_ID, 'signup', @@ -44,14 +51,91 @@ class AccountController extends Controller { * @NoCSRFRequired * */ - public function createAccount() { - return new TemplateResponse( - Application::APP_ID, - 'create-account', - ['appName' => Application::APP_ID], - TemplateResponse::RENDER_AS_GUEST - ); - } + // public function recaptcha() + // { + // session_set_cookie_params(['SameSite' => 'None', 'Secure' => true]); + // session_start(); + + // $width = 80; + // $height = 40; + // $length = 2; + // $liste = '123456789ABCDEFGHIJKLMNPQRSTUVWXYZ'; + // $numbers = '123456789'; + // $symbols = '+-'; + // $code = ''; + // $counter = 0; + // $im = imagecreatetruecolor($width, $height); + // $ns = imagecolorallocate($im, 200, 200, 200); //noise color + // //amount of background noise to add in captcha image + // $noise_level = 13; + + // $image = imagecreate($width, $height) or die('Impossible d\'initializer GD'); + + // for ($i = 0; $i < 10; $i++) { + // imageline( + // $image, + // mt_rand(0, $width), + // mt_rand(0, $height), + // mt_rand(0, $width), + // mt_rand(0, $height), + // imagecolorallocate( + // $image, + // mt_rand(200, 255), + // mt_rand(200, 255), + // mt_rand(200, 255) + // ) + // ); + // } + // $x = 10 + mt_rand(0, 10); + // $num1 = substr($numbers, rand(0, strlen($numbers) - 1), 1); + // $this->update_image($image, $x, $num1); + + // $x += 10 + mt_rand(0, 10); + // $sym = substr($symbols, rand(0, strlen($symbols) - 1), 1); + // $this->update_image($image, $x, $sym); + + // $x += 10 + mt_rand(0, 10); + // $num2 = substr($numbers, rand(0, strlen($numbers) - 1), 1); + // $this->update_image($image, $x, $num2); + + // # Rotate numbers randomly -15 to +15 degrees + // $image = imagerotate($image, mt_rand(-15, 15), 0); + + // $x += 10 + mt_rand(0, 10); + // $this->update_image($image, $x, "="); + + // $code = $num1 . $sym . $num2; + + // eval("\$code = $code;"); + + // // Add some noise to the image. + // for ($i = 0; $i < $noise_level; $i++) { + // for ($j = 0; $j < $noise_level; $j++) { + // imagesetpixel( + // $image, + // rand(0, $width), + // rand(0, $height), //make sure the pixels are rcandom and don't overflow out of the image + // $ns + // ); + // } + // } + + // header('Content-Type: image/png'); + // imagepng($image); + // imagedestroy($image); + + // $_SESSION['securecode'] = "$code"; + // } - + // function update_image(&$image, $x, $num) + // { + // imagechar( + // $image, + // mt_rand(4, 5), + // $x, + // mt_rand(5, 20), + // $num, + // imagecolorallocate($image, mt_rand(0, 155), mt_rand(0, 155), mt_rand(0, 155)) + // ); + // } } diff --git a/src/CreateAccount.vue b/src/CreateAccount.vue deleted file mode 100644 index f724a02c..00000000 --- a/src/CreateAccount.vue +++ /dev/null @@ -1,316 +0,0 @@ - - - - diff --git a/src/Signup.vue b/src/Signup.vue index 7c30b740..67c00a2d 100644 --- a/src/Signup.vue +++ b/src/Signup.vue @@ -3,46 +3,81 @@

- {{ getLocalizedText('Request Murena Account') }} + {{ getLocalizedText('Create Murena Account') }}

+ +
+
+
+ + +

+ {{ getLocalizedText('Display name is required.') }} +

+
+
+
+
- +

{{ getLocalizedText('Email is required.') }}

+
+ +
- -
+
+
+
+ +
+ + +
+

+ {{ getLocalizedText('Password is required.') }} +

+

+ {{ getLocalizedText('Confirm password is required.') }} +

+
+ + + +
+
- {{ getLocalizedText('Request Invitation') }} + {{ getLocalizedText('Signup') }}
@@ -63,32 +98,33 @@ export default { data() { return { appName: APPLICATION_NAME, + domain: window.location.host, + displayname: '', email: '', - confirmEmail: '', + username: '', + password: '', + repassword: '', isEmailEmpty: false, - isConfirmEmailEmpty: false, + isDisplayNameEmpty: false, + isUsernameEmpty: false, + isPasswordEmpty: false, + isRePasswordEmpty: false, } }, methods: { async submitSignupForm() { try { - if (this.email === '') { - this.isEmailEmpty = true - } else { - this.isEmailEmpty = false - } + this.isEmailEmpty = this.email === ''; + this.isDisplayNameEmpty = this.displayname === ''; + this.isUsernameEmpty = this.username === ''; + this.isPasswordEmpty = this.password === ''; + this.isRePasswordEmpty = this.repassword === ''; - if (this.confirmEmail === '') { - this.isConfirmEmailEmpty = true - } else { - this.isConfirmEmailEmpty = false - } - - if (!this.isEmailEmpty && !this.isConfirmEmailEmpty) { + if (!this.isEmailEmpty && !this.isDisplayNameEmpty && !this.isUsernameEmpty) { // submit form } } catch (error) { - this.showError(this.getLocalizedText('Something went wrong.')) + this.showError(this.getLocalizedText('Something went wrong.')); } }, getLocalizedText(text) { @@ -125,7 +161,6 @@ export default { } #fields { - font-size: 0; background-color: white; } @@ -159,6 +194,13 @@ export default { #fields .control { text-align: left; margin-top: 10px; + margin-bottom: 10px; +} + +#fields input#username, +#fields input#new-password, +#fields input#repassword { + width: 50%; } #fields .form-input { @@ -174,11 +216,19 @@ export default { border-radius: 8px; padding: 10px 20px; margin-top: 10px; - margin-bottom: 20px; + margin-bottom: 10px; +} + +.username-group { + display: flex; +} + +#username-domain-div { + display: flex; + align-items: center; } #fields { - font-size: 0; background-color: white; } @@ -222,18 +272,6 @@ export default { font-weight: 900; } -#repassword { - width: 48%; - margin-left: 4%; -} - -#password { - width: 48%; -} - -#username { - width: 70%; -} sup { color: #ff0000; diff --git a/src/create-account.js b/src/create-account.js deleted file mode 100644 index ddfac174..00000000 --- a/src/create-account.js +++ /dev/null @@ -1,8 +0,0 @@ -import Vue from 'vue' -import './common.js' -import Signup from './CreateAccount.vue' - -export default new Vue({ - el: '#ecloud-accounts-create-account', - render: h => h(Signup), -}) diff --git a/templates/create-account.php b/templates/create-account.php deleted file mode 100644 index c5e0eb54..00000000 --- a/templates/create-account.php +++ /dev/null @@ -1,4 +0,0 @@ - -
\ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js index 5070b126..b6eaacba 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -9,7 +9,6 @@ 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'), - 'create-account': path.join(__dirname, 'src/create-account.js'), + 'signup': path.join(__dirname, 'src/signup.js') }, } -- GitLab From ff9d03636648688f85e567aeba20affa38565164 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Mon, 21 Aug 2023 10:09:21 -0700 Subject: [PATCH 009/211] LDAP added --- appinfo/routes.php | 1 + lib/Controller/AccountController.php | 122 +++++++++++++++++++++++++- lib/Service/LDAPConnectionService.php | 19 +++- src/Signup.vue | 61 ++++++++----- 4 files changed, 178 insertions(+), 25 deletions(-) diff --git a/appinfo/routes.php b/appinfo/routes.php index 36ae5574..a2d08a16 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -25,5 +25,6 @@ return ['routes' => [ 'url' => '/issue/submit', 'verb' => 'POST' ], ['name' => 'account#index', 'url' => '/account/signup', 'verb' => 'GET'], + ['name' => 'account#create', 'url' => '/account/create', 'verb' => 'POST'], // ['name' => 'account#recaptcha', 'url' => '/account/recaptcha', 'verb' => 'GET'], ]]; diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index 71e2f7d4..8771888f 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -10,23 +10,42 @@ use OCP\AppFramework\Controller; use OCP\IRequest; use OCP\AppFramework\Http\TemplateResponse; use OCA\EcloudAccounts\AppInfo\Application; +use OCA\EcloudAccounts\Service\LDAPConnectionService; +use OCA\EcloudAccounts\Service\AccountService; use OCP\ISession; +use Psr\Log\LoggerInterface; +use OCA\LdapWriteSupport\Service\Configuration; +use OCP\LDAP\ILDAPProvider; +use Exception; class AccountController extends Controller { protected $appName; protected $request; // private ISession $session; + private $LDAPConnectionService; + private $logger; + private $configuration; + private $ldapProvider; + private $ldapConnect; public function __construct( $AppName, IRequest $request, - ISession $session + // ISession $session, + LDAPConnectionService $LDAPConnectionService, + LoggerInterface $logger, + ILDAPProvider $LDAPProvider, + Configuration $configuration ) { parent::__construct($AppName, $request); $this->appName = $AppName; // $this->session = $session; + $this->LDAPConnectionService = $LDAPConnectionService; + $this->ldapProvider = $LDAPProvider; + $this->configuration = $configuration; + $this->logger = $logger; } /** @@ -44,6 +63,107 @@ class AccountController extends Controller TemplateResponse::RENDER_AS_GUEST ); } + /** + * @NoAdminRequired + * @PublicPage + * @NoCSRFRequired + * + */ + public function create(string $displayname, string $email, string $username, string $password) + { + $connection = $this->LDAPConnectionService->getLDAPConnection(); + // $base = $this->LDAPConnectionService->getLDAPBaseUsers()[0]; + // $displayNameAttribute = $this->LDAPConnectionService->getDisplayNameAttribute(); + $base = ''; + [$newUserDN, $newUserEntry] = $this->buildNewEntry($username, $password, $base); + $newUserDN = $this->ldapProvider->sanitizeDN([$newUserDN])[0]; + // $this->ensureAttribute($newUserEntry, $displayNameAttribute, $username); + + $ret = ldap_add($connection, $newUserDN, $newUserEntry); + + $message = 'Create LDAP user \'{username}\' ({dn})'; + $logMethod = 'info'; + if ($ret === false) { + $message = 'Unable to create LDAP user \'{username}\' ({dn})'; + $logMethod = 'error'; + } + $this->logger->$logMethod($message, [ + 'app' => Application::APP_ID, + 'username' => $username, + 'dn' => $newUserDN, + ]); + + if (!$ret && $this->configuration->isPreventFallback()) { + throw new \Exception('Cannot create user: ' . ldap_error($connection), ldap_errno($connection)); + } + + // Set password through ldap password exop, if supported + try { + $ret = ldap_exop_passwd($connection, $newUserDN, '', $password); + if ($ret === false) { + $message = 'ldap_exop_passwd failed, falling back to ldap_mod_replace to to set password for new user'; + $this->logger->debug($message, ['app' => Application::APP_ID]); + + // Fallback to `userPassword` in case the server does not support exop_passwd + $ret = ldap_mod_replace($connection, $newUserDN, ['userPassword' => $password]); + if ($ret === false) { + $message = 'Failed to set password for new user {dn}'; + $this->logger->error($message, [ + 'app' => Application::APP_ID, + 'dn' => $newUserDN, + ]); + } + } + } catch (\Exception $e) { + $this->logger->error($e->getMessage(), ['exception' => $e, 'app' => Application::APP_ID]); + } + return $ret ? $newUserDN : false; + } + public function buildNewEntry($username, $password, $base): array + { + // Make sure the parameters don't fool the following algorithm + if (strpos($username, PHP_EOL) !== false) { + throw new Exception('Username contains a new line'); + } + if (strpos($password, PHP_EOL) !== false) { + throw new Exception('Password contains a new line'); + } + if (strpos($base, PHP_EOL) !== false) { + throw new Exception('Base DN contains a new line'); + } + + $ldif = $this->configuration->getUserTemplate(); + + $ldif = str_replace('{UID}', $username, $ldif); + $ldif = str_replace('{PWD}', $password, $ldif); + $ldif = str_replace('{BASE}', $base, $ldif); + + $entry = []; + $lines = explode(PHP_EOL, $ldif); + foreach ($lines as $line) { + $split = explode(':', $line, 2); + $key = trim($split[0]); + $value = trim($split[1]); + if (!isset($entry[$key])) { + $entry[$key] = $value; + } else if (is_array($entry[$key])) { + $entry[$key][] = $value; + } else { + $entry[$key] = [$entry[$key], $value]; + } + } + $dn = $entry['dn']; + unset($entry['dn']); + + return [$dn, $entry]; + } + public function ensureAttribute(array &$ldif, string $attribute, string $fallbackValue): void + { + $lowerCasedLDIF = array_change_key_case($ldif, CASE_LOWER); + if (!isset($lowerCasedLDIF[strtolower($attribute)])) { + $ldif[$attribute] = $fallbackValue; + } + } /** * @NoAdminRequired diff --git a/lib/Service/LDAPConnectionService.php b/lib/Service/LDAPConnectionService.php index a45024e6..bba572cb 100644 --- a/lib/Service/LDAPConnectionService.php +++ b/lib/Service/LDAPConnectionService.php @@ -6,6 +6,8 @@ namespace OCA\EcloudAccounts\Service; use Exception; use OCP\IUserManager; +use OCA\User_LDAP\Configuration; +use OCA\User_LDAP\Helper; class LDAPConnectionService { /** @var IUserManager */ @@ -16,10 +18,14 @@ class LDAPConnectionService { private $ldapEnabled; private $access; + private $ldapConfig; - public function __construct(IUserManager $userManager) { + public function __construct(IUserManager $userManager,Helper $ldapBackendHelper) { $this->userManager = $userManager; $this->getConfigurationFromBackend(); + $ldapConfigPrefixes = $ldapBackendHelper->getServerConfigurationPrefixes(true); + $prefix = array_shift($ldapConfigPrefixes); + $this->ldapConfig = new Configuration($prefix); } @@ -93,4 +99,15 @@ class LDAPConnectionService { } return $this->access; } + + public function getLDAPBaseUsers(): array { + $bases = $this->ldapConfig->ldapBaseUsers; + if(empty($bases)) { + $bases = $this->ldapConfig->ldapBase; + } + return $bases; + } + public function getDisplayNameAttribute(): string { + return $this->ldapConfig->ldapUserDisplayName; + } } diff --git a/src/Signup.vue b/src/Signup.vue index 67c00a2d..4ab10ecd 100644 --- a/src/Signup.vue +++ b/src/Signup.vue @@ -6,13 +6,12 @@ {{ getLocalizedText('Create Murena Account') }}
-
+ class="form-input" :placeholder="getLocalizedText('Your name as shown to others')">

{{ getLocalizedText('Display name is required.') }}

@@ -33,15 +32,16 @@
-
- -
@{{ domain }}
+
+ @{{ domain }} +

{{ getLocalizedText('Username is required.') }} @@ -55,9 +55,9 @@

- -

@@ -66,12 +66,16 @@

{{ getLocalizedText('Confirm password is required.') }}

+

+ {{ getLocalizedText('The confirm password does not match the password.') }} +

+
- -
@@ -88,6 +92,9 @@ @@ -272,7 +288,6 @@ export default { font-weight: 900; } - sup { color: #ff0000; font-weight: 500; -- GitLab From 79ae2184c087c53e76f72fcfa4bae2996306cdca Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Mon, 21 Aug 2023 10:16:03 -0700 Subject: [PATCH 010/211] lint and php lint --- lib/Controller/AccountController.php | 20 +++------ lib/Service/LDAPConnectionService.php | 4 +- src/Signup.vue | 62 ++++++++++++++++++--------- 3 files changed, 50 insertions(+), 36 deletions(-) diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index 8771888f..cec2a051 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -11,15 +11,13 @@ use OCP\IRequest; use OCP\AppFramework\Http\TemplateResponse; use OCA\EcloudAccounts\AppInfo\Application; use OCA\EcloudAccounts\Service\LDAPConnectionService; -use OCA\EcloudAccounts\Service\AccountService; use OCP\ISession; use Psr\Log\LoggerInterface; use OCA\LdapWriteSupport\Service\Configuration; use OCP\LDAP\ILDAPProvider; use Exception; -class AccountController extends Controller -{ +class AccountController extends Controller { protected $appName; protected $request; // private ISession $session; @@ -41,7 +39,7 @@ class AccountController extends Controller ) { parent::__construct($AppName, $request); $this->appName = $AppName; - // $this->session = $session; + // $this->session = $session; $this->LDAPConnectionService = $LDAPConnectionService; $this->ldapProvider = $LDAPProvider; $this->configuration = $configuration; @@ -54,8 +52,7 @@ class AccountController extends Controller * @NoCSRFRequired * */ - public function index() - { + public function index() { return new TemplateResponse( Application::APP_ID, 'signup', @@ -69,8 +66,7 @@ class AccountController extends Controller * @NoCSRFRequired * */ - public function create(string $displayname, string $email, string $username, string $password) - { + public function create(string $displayname, string $email, string $username, string $password) { $connection = $this->LDAPConnectionService->getLDAPConnection(); // $base = $this->LDAPConnectionService->getLDAPBaseUsers()[0]; // $displayNameAttribute = $this->LDAPConnectionService->getDisplayNameAttribute(); @@ -119,8 +115,7 @@ class AccountController extends Controller } return $ret ? $newUserDN : false; } - public function buildNewEntry($username, $password, $base): array - { + public function buildNewEntry($username, $password, $base): array { // Make sure the parameters don't fool the following algorithm if (strpos($username, PHP_EOL) !== false) { throw new Exception('Username contains a new line'); @@ -146,7 +141,7 @@ class AccountController extends Controller $value = trim($split[1]); if (!isset($entry[$key])) { $entry[$key] = $value; - } else if (is_array($entry[$key])) { + } elseif (is_array($entry[$key])) { $entry[$key][] = $value; } else { $entry[$key] = [$entry[$key], $value]; @@ -157,8 +152,7 @@ class AccountController extends Controller return [$dn, $entry]; } - public function ensureAttribute(array &$ldif, string $attribute, string $fallbackValue): void - { + public function ensureAttribute(array &$ldif, string $attribute, string $fallbackValue): void { $lowerCasedLDIF = array_change_key_case($ldif, CASE_LOWER); if (!isset($lowerCasedLDIF[strtolower($attribute)])) { $ldif[$attribute] = $fallbackValue; diff --git a/lib/Service/LDAPConnectionService.php b/lib/Service/LDAPConnectionService.php index bba572cb..35e80269 100644 --- a/lib/Service/LDAPConnectionService.php +++ b/lib/Service/LDAPConnectionService.php @@ -20,7 +20,7 @@ class LDAPConnectionService { private $access; private $ldapConfig; - public function __construct(IUserManager $userManager,Helper $ldapBackendHelper) { + public function __construct(IUserManager $userManager, Helper $ldapBackendHelper) { $this->userManager = $userManager; $this->getConfigurationFromBackend(); $ldapConfigPrefixes = $ldapBackendHelper->getServerConfigurationPrefixes(true); @@ -102,7 +102,7 @@ class LDAPConnectionService { public function getLDAPBaseUsers(): array { $bases = $this->ldapConfig->ldapBaseUsers; - if(empty($bases)) { + if (empty($bases)) { $bases = $this->ldapConfig->ldapBase; } return $bases; diff --git a/src/Signup.vue b/src/Signup.vue index 4ab10ecd..54b30ea9 100644 --- a/src/Signup.vue +++ b/src/Signup.vue @@ -10,8 +10,12 @@
- +

{{ getLocalizedText('Display name is required.') }}

@@ -23,7 +27,11 @@
-

{{ getLocalizedText('Email is required.') }} @@ -37,8 +45,12 @@

- +
@{{ domain }}
@@ -55,10 +67,18 @@
- - + +

{{ getLocalizedText('Password is required.') }} @@ -69,20 +89,25 @@

{{ getLocalizedText('The confirm password does not match the password.') }}

-
-
- +
@@ -91,7 +116,6 @@ -- GitLab From 6a7ffcb6d1bc49fb36e8aa4deab1a7738765d80a Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Wed, 23 Aug 2023 20:58:45 -0700 Subject: [PATCH 045/211] validation changes --- src/Signup.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Signup.vue b/src/Signup.vue index 7786eaf3..eff615df 100644 --- a/src/Signup.vue +++ b/src/Signup.vue @@ -163,7 +163,6 @@ export default { } catch (error) { const errorMessage = error.response?.data?.message || this.getLocalizedText('Something went wrong.') this.showMessage(errorMessage, 'error') - this.setAllFieldsBlank() } } }, -- GitLab From 5b481fda9861dbe64a8542a15083491cbd044f1e Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Wed, 23 Aug 2023 21:04:59 -0700 Subject: [PATCH 046/211] width primary added --- src/Signup.vue | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Signup.vue b/src/Signup.vue index eff615df..a4f69d27 100644 --- a/src/Signup.vue +++ b/src/Signup.vue @@ -94,9 +94,10 @@
- +
@@ -336,6 +337,9 @@ sup { .validation-error { color: #ff0000; } +.width300{ + width: 300px; +} @media screen and (max-width: 500px) { #main { -- GitLab From 1d1cbc9ac77728d03e0e9615f17f3993d4b147e5 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Wed, 23 Aug 2023 21:21:41 -0700 Subject: [PATCH 047/211] password checked added --- package-lock.json | 33 ++++++++++++++++++++++++++++++++- package.json | 7 ++++--- src/Signup.vue | 25 +++++++++++++++++-------- 3 files changed, 53 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5077e57f..6a1bd3d6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,8 @@ "@nextcloud/l10n": "^1.6.0", "@nextcloud/router": "^2.0.0", "@nextcloud/vue": "^5.4.0", - "vue": "^2.7.0" + "vue": "^2.7.0", + "vue-password-strength-meter": "^1.7.2" }, "devDependencies": { "@nextcloud/babel-config": "^1.0.0", @@ -11137,6 +11138,18 @@ "resolved": "https://registry.npmjs.org/vue-observe-visibility/-/vue-observe-visibility-0.4.6.tgz", "integrity": "sha512-xo0CEVdkjSjhJoDdLSvoZoQrw/H2BlzB5jrCBKGZNXN2zdZgMuZ9BKrxXDjNP2AxlcCoKc8OahI3F3r3JGLv2Q==" }, + "node_modules/vue-password-strength-meter": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/vue-password-strength-meter/-/vue-password-strength-meter-1.7.2.tgz", + "integrity": "sha512-S17DsEbXciTcI0fKq1PXia7i3COM/AJOT7os8AVyGxglc5ho1EBssE+ogDa5cFh6Rn8pPgqfVCt/KBcNpgPBiA==", + "engines": { + "node": ">= 4.0.0", + "npm": ">= 3.0.0" + }, + "peerDependencies": { + "zxcvbn": "^4.4.2" + } + }, "node_modules/vue-resize": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/vue-resize/-/vue-resize-1.0.1.tgz", @@ -11796,6 +11809,12 @@ "funding": { "url": "https://github.com/sponsors/sindresorhus" } + }, + "node_modules/zxcvbn": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/zxcvbn/-/zxcvbn-4.4.2.tgz", + "integrity": "sha512-Bq0B+ixT/DMyG8kgX2xWcI5jUvCwqrMxSFam7m0lAf78nf04hv6lNCsyLYdyYTrCVMqNDY/206K7eExYCeSyUQ==", + "peer": true } }, "dependencies": { @@ -20246,6 +20265,12 @@ "resolved": "https://registry.npmjs.org/vue-observe-visibility/-/vue-observe-visibility-0.4.6.tgz", "integrity": "sha512-xo0CEVdkjSjhJoDdLSvoZoQrw/H2BlzB5jrCBKGZNXN2zdZgMuZ9BKrxXDjNP2AxlcCoKc8OahI3F3r3JGLv2Q==" }, + "vue-password-strength-meter": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/vue-password-strength-meter/-/vue-password-strength-meter-1.7.2.tgz", + "integrity": "sha512-S17DsEbXciTcI0fKq1PXia7i3COM/AJOT7os8AVyGxglc5ho1EBssE+ogDa5cFh6Rn8pPgqfVCt/KBcNpgPBiA==", + "requires": {} + }, "vue-resize": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/vue-resize/-/vue-resize-1.0.1.tgz", @@ -20724,6 +20749,12 @@ "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", "dev": true, "peer": true + }, + "zxcvbn": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/zxcvbn/-/zxcvbn-4.4.2.tgz", + "integrity": "sha512-Bq0B+ixT/DMyG8kgX2xWcI5jUvCwqrMxSFam7m0lAf78nf04hv6lNCsyLYdyYTrCVMqNDY/206K7eExYCeSyUQ==", + "peer": true } } } diff --git a/package.json b/package.json index 83b8a14f..74dc503c 100644 --- a/package.json +++ b/package.json @@ -9,8 +9,8 @@ "private": true, "scripts": { "build": "NODE_ENV=production webpack --progress", - "dev": "NODE_ENV=development webpack --progress", - "watch": "NODE_ENV=development webpack --progress --watch", + "dev": "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", "stylelint": "stylelint {src,css}/**/{*.scss,*.css} --allow-empty-input", @@ -23,7 +23,8 @@ "@nextcloud/l10n": "^1.6.0", "@nextcloud/router": "^2.0.0", "@nextcloud/vue": "^5.4.0", - "vue": "^2.7.0" + "vue": "^2.7.0", + "vue-password-strength-meter": "^1.7.2" }, "browserslist": [ "extends @nextcloud/browserslist-config" diff --git a/src/Signup.vue b/src/Signup.vue index a4f69d27..c6564d02 100644 --- a/src/Signup.vue +++ b/src/Signup.vue @@ -13,7 +13,7 @@

@@ -67,12 +67,13 @@

- + :placeholder="getLocalizedText('Password')" /> +
- + {{ getLocalizedText('Signup') }} +
@@ -109,11 +112,13 @@ import Axios from '@nextcloud/axios' import { showSuccess, showError } from '@nextcloud/dialogs' import { generateUrl } from '@nextcloud/router' +import Password from 'vue-password-strength-meter' const APPLICATION_NAME = 'ecloud-accounts' export default { name: 'Signup', + components: { Password }, data() { return { appName: APPLICATION_NAME, @@ -337,8 +342,12 @@ sup { .validation-error { color: #ff0000; } -.width300{ + +.btn-primary { width: 300px; + background-color: var(--color-primary); + color: white; + border-color: var(--color-primary); } @media screen and (max-width: 500px) { -- GitLab From dd242fef0b7af80d6af7c98eb8deeec29f457404 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Wed, 23 Aug 2023 21:27:13 -0700 Subject: [PATCH 048/211] password checked added --- src/Signup.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Signup.vue b/src/Signup.vue index c6564d02..226ed617 100644 --- a/src/Signup.vue +++ b/src/Signup.vue @@ -68,7 +68,8 @@
Date: Wed, 23 Aug 2023 21:40:30 -0700 Subject: [PATCH 049/211] defaultClass added --- src/Signup.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Signup.vue b/src/Signup.vue index 226ed617..20a17a4c 100644 --- a/src/Signup.vue +++ b/src/Signup.vue @@ -72,7 +72,7 @@ :badge="false" type="password" name="password" - class="form-input" + :defaultClass="form-input" :placeholder="getLocalizedText('Password')" /> Date: Wed, 23 Aug 2023 21:53:24 -0700 Subject: [PATCH 050/211] lint --- src/Signup.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Signup.vue b/src/Signup.vue index 20a17a4c..1032c843 100644 --- a/src/Signup.vue +++ b/src/Signup.vue @@ -72,7 +72,7 @@ :badge="false" type="password" name="password" - :defaultClass="form-input" + :default-class="form-input" :placeholder="getLocalizedText('Password')" /> Date: Wed, 23 Aug 2023 22:29:36 -0700 Subject: [PATCH 051/211] overflow added --- src/Signup.vue | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Signup.vue b/src/Signup.vue index 1032c843..e4ff9491 100644 --- a/src/Signup.vue +++ b/src/Signup.vue @@ -194,6 +194,9 @@ export default { } + +.np-captcha-container { + background: #eee; + width: 300px; + margin: 0 auto; + margin-bottom: 20px; +} + +.np-captcha { + font-size: 24px; +} + +.np-button { + padding: 6px 10px; + background: #fff; + border: 1px solid #eee; + border-radius: 6px; + font-size: 16px; +} + +.np-captcha-character { + display: inline-block; + letter-spacing: 14px; +} -- GitLab From b9813626c4361aaac2afe3b021752356754bbf5c Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Thu, 24 Aug 2023 21:27:48 -0700 Subject: [PATCH 060/211] verifiction code added --- src/Signup.vue | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/src/Signup.vue b/src/Signup.vue index ef5cb51a..2964a04e 100644 --- a/src/Signup.vue +++ b/src/Signup.vue @@ -98,7 +98,25 @@
-
+
+
+ +
+ +
+

+ {{ getLocalizedText('Human Verification is required.') }} +

+

+ {{ getLocalizedText('Secure code is not correct!') }} +

+
+
- {{ captchatext }} - +
@@ -153,6 +168,7 @@ export default { username: '', password: '', repassword: '', + humanverification: '', validation: { isEmailEmpty: false, isDisplaynameEmpty: false, @@ -160,6 +176,8 @@ export default { isPasswordEmpty: false, isRepasswordEmpty: false, isRePasswordMatched: false, + isHumanverificationEmpty: false, + isHumanverificationMatched: false, }, captchaLength: 5, captcha: [], @@ -171,11 +189,12 @@ export default { }, methods: { validateForm() { - const fieldsToValidate = ['email', 'displayname', 'username', 'password', 'repassword'] + const fieldsToValidate = ['email', 'displayname', 'username', 'password', 'repassword', 'humanverification'] fieldsToValidate.forEach(field => { this.validation[`is${field.charAt(0).toUpperCase() + field.slice(1)}Empty`] = this[field] === '' }) this.validation.isRePasswordMatched = this.repassword !== this.password + this.validation.isHumanverificationMatched = this.humanverification !== this.captchatext }, async submitSignupForm() { this.validateForm() @@ -406,7 +425,7 @@ sup { } .btn-primary { - width: 20vw; + width: 95%; background-color: var(--color-primary); color: white; border-color: var(--color-primary); @@ -427,10 +446,14 @@ sup { font-size: 10px; } } - +.np-captcha-section +{ + display: flex; + width: fit-content; +} .np-captcha-container { background: #eee; - width: 300px; + width: max-content; margin: 0 auto; margin-bottom: 20px; } -- GitLab From 03647071876988b36cb91629bd4aeaaaac54fc9a Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Thu, 24 Aug 2023 21:29:26 -0700 Subject: [PATCH 061/211] verifiction code added --- src/Signup.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Signup.vue b/src/Signup.vue index 2964a04e..1029f903 100644 --- a/src/Signup.vue +++ b/src/Signup.vue @@ -452,10 +452,11 @@ sup { width: fit-content; } .np-captcha-container { - background: #eee; + background: #ffdada; width: max-content; margin: 0 auto; margin-bottom: 20px; + padding: 10px; } .np-captcha { -- GitLab From 49fce267fe3d413030ca0044dd4929a004093c42 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Thu, 24 Aug 2023 21:33:49 -0700 Subject: [PATCH 062/211] verifiction code added #2 --- src/Signup.vue | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/Signup.vue b/src/Signup.vue index 1029f903..89f3ca4a 100644 --- a/src/Signup.vue +++ b/src/Signup.vue @@ -98,7 +98,7 @@
-
+
@@ -116,8 +116,12 @@ {{ getLocalizedText('Secure code is not correct!') }}

+
+
-
+
+
+
- +
+