From 7f84c52c8311b42a03471fd83fb2f23e0c0ac251 Mon Sep 17 00:00:00 2001 From: Joel Jacob Stephen <70131076+JoelJacobStephen@users.noreply.github.com> Date: Wed, 19 Feb 2025 08:41:20 -0600 Subject: [PATCH] feat(sh-admin): introduce input validations to server configurations (#4642) Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com> --- packages/hoppscotch-sh-admin/locales/en.json | 2 + .../hoppscotch-sh-admin/src/components.d.ts | 2 + .../components/settings/SmtpConfiguration.vue | 37 ++++++++++++++++++- .../src/helpers/configs.ts | 4 ++ .../src/pages/settings.vue | 14 ++++++- .../src/pages/teams/index.vue | 7 +++- .../src/pages/users/index.vue | 7 +++- 7 files changed, 68 insertions(+), 5 deletions(-) diff --git a/packages/hoppscotch-sh-admin/locales/en.json b/packages/hoppscotch-sh-admin/locales/en.json index e7bcd817..37dc5afc 100644 --- a/packages/hoppscotch-sh-admin/locales/en.json +++ b/packages/hoppscotch-sh-admin/locales/en.json @@ -31,6 +31,7 @@ }, "confirm_changes": "Hoppscotch server must restart to reflect the new changes. Confirm changes made to the server configurations?", "input_empty": "Please fill all the fields before updating the configurations", + "input_validation_error": "Some fields have invalid values. Please correct them before updating the configurations", "data_sharing": { "title": "Data Sharing", "description": "Help improve Hoppscotch by sharing anonymous data", @@ -48,6 +49,7 @@ "enable_email_auth": "Enable Email based authentication", "enable_smtp": "Enable SMTP", "host": "MAILER HOST", + "input_validation": "SMTP URL should start with smtp(s)://", "password": "MAILER PASSWORD", "port": "MAILER PORT", "secure": "MAILER SECURE", diff --git a/packages/hoppscotch-sh-admin/src/components.d.ts b/packages/hoppscotch-sh-admin/src/components.d.ts index 0d8c40d4..55894938 100644 --- a/packages/hoppscotch-sh-admin/src/components.d.ts +++ b/packages/hoppscotch-sh-admin/src/components.d.ts @@ -40,8 +40,10 @@ declare module 'vue' { IconLucideChevronDown: typeof import('~icons/lucide/chevron-down')['default'] IconLucideHelpCircle: typeof import('~icons/lucide/help-circle')['default'] IconLucideInbox: typeof import('~icons/lucide/inbox')['default'] + IconLucideInfo: typeof import('~icons/lucide/info')['default'] IconLucideSearch: typeof import('~icons/lucide/search')['default'] IconLucideUser: typeof import('~icons/lucide/user')['default'] + IconLucideX: typeof import('~icons/lucide/x')['default'] SettingsAuthProvider: typeof import('./components/settings/AuthProvider.vue')['default'] SettingsConfigurations: typeof import('./components/settings/Configurations.vue')['default'] SettingsDataSharing: typeof import('./components/settings/DataSharing.vue')['default'] diff --git a/packages/hoppscotch-sh-admin/src/components/settings/SmtpConfiguration.vue b/packages/hoppscotch-sh-admin/src/components/settings/SmtpConfiguration.vue index 63763262..38f62a56 100644 --- a/packages/hoppscotch-sh-admin/src/components/settings/SmtpConfiguration.vue +++ b/packages/hoppscotch-sh-admin/src/components/settings/SmtpConfiguration.vue @@ -87,6 +87,16 @@ @click="toggleMask(field.key)" /> + +