From 5a86d6bb6dea9b774c95268b895771cd61525d5d Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Fri, 9 Jul 2021 15:05:39 +0100 Subject: [PATCH] Linting and Optimisation --- .../auth/_components/OIDCButton.svelte | 16 +++++++------ .../src/pages/builder/auth/login.svelte | 5 +++- .../builder/portal/manage/auth/index.svelte | 20 ++++++++++++---- .../builder/src/stores/portal/organisation.js | 2 ++ .../src/api/controllers/admin/configs.js | 24 +++---------------- .../worker/src/api/routes/admin/configs.js | 2 +- 6 files changed, 34 insertions(+), 35 deletions(-) diff --git a/packages/builder/src/pages/builder/auth/_components/OIDCButton.svelte b/packages/builder/src/pages/builder/auth/_components/OIDCButton.svelte index 93f34106b0..351370b871 100644 --- a/packages/builder/src/pages/builder/auth/_components/OIDCButton.svelte +++ b/packages/builder/src/pages/builder/auth/_components/OIDCButton.svelte @@ -15,18 +15,21 @@ Oidc: OidcLogo, Oracle: OracleLogo, Auth0: Auth0Logo, - AD: MicrosoftLogo + AD: MicrosoftLogo, } $: show = $admin.checklist?.oidc {#if show} - window.open("/api/admin/auth/oidc", "_blank")} - > + window.open("/api/admin/auth/oidc", "_blank")}>
- oidc icon -

{`Sign in with ${oidcName || 'OIDC'}`}

+ oidc icon +

{`Sign in with ${oidcName || "OIDC"}`}

{/if} @@ -48,4 +51,3 @@ margin: 0; } - diff --git a/packages/builder/src/pages/builder/auth/login.svelte b/packages/builder/src/pages/builder/auth/login.svelte index d51134d13c..69b76a129b 100644 --- a/packages/builder/src/pages/builder/auth/login.svelte +++ b/packages/builder/src/pages/builder/auth/login.svelte @@ -62,7 +62,10 @@ Sign in to {company} - + Sign in with email diff --git a/packages/builder/src/pages/builder/portal/manage/auth/index.svelte b/packages/builder/src/pages/builder/portal/manage/auth/index.svelte index 3754316834..ddda8e226b 100644 --- a/packages/builder/src/pages/builder/portal/manage/auth/index.svelte +++ b/packages/builder/src/pages/builder/portal/manage/auth/index.svelte @@ -19,6 +19,13 @@ } from "@budibase/bbui" import { onMount } from "svelte" import api from "builderStore/api" + import { writable } from "svelte/store" + import { organisation } from "stores/portal" + + const values = writable({ + oidcIcon: $organisation.oidcIcon, + oidcName: $organisation.oidcName, + }) const ConfigTypes = { Google: "google", @@ -39,12 +46,12 @@ } const OIDCConfigFields = { - Oidc: ["configUrl", "clientID", "clientSecret"], + Oidc: ["configUrl", "clientId", "clientSecret"], } const OIDCConfigLabels = { Oidc: { configUrl: "Config URL", - clientID: "Client ID", + clientId: "Client ID", clientSecret: "Client Secret", }, } @@ -81,8 +88,9 @@ const onFileSelected = e => { let fileName = e.target.files[0].name image = e.target.files[0] - providers.oidc.config["iconName"] = fileName + $values.oidcIcon = fileName iconDropdownOptions.unshift({ label: fileName, value: fileName }) + image && uploadLogo(image) } const providers = { google, oidc } @@ -90,6 +98,7 @@ async function save(docs) { // only if the user has provided an image, upload it. image && uploadLogo(image) + await organisation.save($values) let calls = [] docs.forEach(element => { calls.push(api.post(`/api/admin/configs`, element)) @@ -116,6 +125,7 @@ } onMount(async () => { + await organisation.init() // fetch the configs for oauth const googleResponse = await api.get( `/api/admin/configs/${ConfigTypes.Google}` @@ -220,13 +230,13 @@
- +