From b5f398da4d691d6ddf677162f0245d57df22e505 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Wed, 7 Jul 2021 13:41:09 +0100 Subject: [PATCH] Allow user uploaded icons in oidc config --- packages/auth/src/constants.js | 3 +- packages/bbui/src/Form/Core/Picker.svelte | 29 +++- packages/bbui/src/Form/Core/Select.svelte | 17 +++ packages/bbui/src/Form/Select.svelte | 9 ++ packages/builder/assets/auth0-logo.png | Bin 0 -> 26590 bytes packages/builder/assets/microsoft-logo.png | Bin 0 -> 5598 bytes packages/builder/assets/oidc-logo.png | Bin 0 -> 19925 bytes packages/builder/assets/oracle-logo.png | Bin 0 -> 26997 bytes .../portal/manage/auth/_logos/OIDC.svelte | 11 +- .../builder/portal/manage/auth/index.svelte | 130 +++++++++++++----- .../src/api/controllers/admin/configs.js | 4 +- .../worker/src/api/routes/admin/configs.js | 2 +- packages/worker/src/constants/index.js | 2 +- 13 files changed, 154 insertions(+), 53 deletions(-) create mode 100644 packages/builder/assets/auth0-logo.png create mode 100644 packages/builder/assets/microsoft-logo.png create mode 100644 packages/builder/assets/oidc-logo.png create mode 100644 packages/builder/assets/oracle-logo.png diff --git a/packages/auth/src/constants.js b/packages/auth/src/constants.js index ace9464e9d..ca0e69b34a 100644 --- a/packages/auth/src/constants.js +++ b/packages/auth/src/constants.js @@ -20,5 +20,6 @@ exports.Configs = { ACCOUNT: "account", SMTP: "smtp", GOOGLE: "google", - OIDC: "oidc" + OIDC: "oidc", + OIDC_LOGOS:"oidc_logos" } diff --git a/packages/bbui/src/Form/Core/Picker.svelte b/packages/bbui/src/Form/Core/Picker.svelte index 5ca413409c..b7f53fb861 100644 --- a/packages/bbui/src/Form/Core/Picker.svelte +++ b/packages/bbui/src/Form/Core/Picker.svelte @@ -10,18 +10,20 @@ export let disabled = false export let error = null export let fieldText = "" + export let fieldIcon = "" export let isPlaceholder = false export let placeholderOption = null export let options = [] + export let callbackOptionValue = null export let isOptionSelected = () => false export let onSelectOption = () => {} export let getOptionLabel = option => option export let getOptionValue = option => option + export let getOptionIcon = option => option export let open = false export let readonly = false export let quiet = false export let autoWidth = false - const dispatch = createEventDispatcher() const onClick = () => { dispatch("click") @@ -30,6 +32,7 @@ } open = true } + console.log(fieldIcon) + @@ -201,4 +251,8 @@ align-items: center; gap: var(--spacing-s); } + + input { + display: none; + } diff --git a/packages/worker/src/api/controllers/admin/configs.js b/packages/worker/src/api/controllers/admin/configs.js index ffd85e98e9..2f62af18bb 100644 --- a/packages/worker/src/api/controllers/admin/configs.js +++ b/packages/worker/src/api/controllers/admin/configs.js @@ -146,7 +146,7 @@ exports.upload = async function (ctx) { } } const url = `/${bucket}/${key}` - cfgStructure.config[`${name}Url`] = url + cfgStructure.config[`${name}`] = url // write back to db with url updated await db.put(cfgStructure) @@ -192,8 +192,6 @@ exports.configChecklist = async function (ctx) { const oidcConfig = await getScopedFullConfig(db, { type: Configs.OIDC, }) - - // They have set up an admin user const users = await db.allDocs( getGlobalUserParams(null, { diff --git a/packages/worker/src/api/routes/admin/configs.js b/packages/worker/src/api/routes/admin/configs.js index 83eec20cf3..2e926b61f0 100644 --- a/packages/worker/src/api/routes/admin/configs.js +++ b/packages/worker/src/api/routes/admin/configs.js @@ -79,7 +79,7 @@ function buildUploadValidation() { // prettier-ignore return joiValidator.params(Joi.object({ type: Joi.string().valid(...Object.values(Configs)).required(), - name: Joi.string().valid(...Object.values(ConfigUploads)).required(), + name: Joi.string().required(), }).required()) } diff --git a/packages/worker/src/constants/index.js b/packages/worker/src/constants/index.js index 70c61cd6b0..ae52af9d7f 100644 --- a/packages/worker/src/constants/index.js +++ b/packages/worker/src/constants/index.js @@ -16,7 +16,7 @@ exports.Configs = Configs exports.ConfigUploads = { LOGO: "logo", - OIDC_LOGO: "oidc_logo" + OIDC_LOGO: "oidc_logo", } const TemplateTypes = {