Fix bug where OIDC icon was not being displayed due to misconfiguration
This commit is contained in:
parent
005e0a2deb
commit
7138070e4c
|
@ -31,7 +31,6 @@
|
|||
}
|
||||
open = true
|
||||
}
|
||||
console.log(fieldIcon)
|
||||
</script>
|
||||
|
||||
<button
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
AD: MicrosoftLogo
|
||||
}
|
||||
$: show = $admin.checklist?.oidc
|
||||
console.log(preDefinedIcons[oidcIcon])
|
||||
</script>
|
||||
|
||||
{#if show}
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
} from "@budibase/bbui"
|
||||
import { onMount } from "svelte"
|
||||
import api from "builderStore/api"
|
||||
import { writable } from "svelte/store"
|
||||
import { organisation } from "stores/portal"
|
||||
|
||||
const ConfigTypes = {
|
||||
Google: "google",
|
||||
|
@ -41,12 +39,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",
|
||||
},
|
||||
}
|
||||
|
|
|
@ -111,15 +111,24 @@ exports.publicSettings = async function (ctx) {
|
|||
const oidcConfig = await getScopedFullConfig(db, {
|
||||
type: Configs.OIDC,
|
||||
})
|
||||
if (!publicConfig) {
|
||||
ctx.body = {}
|
||||
} else {
|
||||
|
||||
if (publicConfig && !oidcConfig) {
|
||||
ctx.body = publicConfig
|
||||
}
|
||||
else if(!publicConfig && oidcConfig) {
|
||||
// Pull out the OIDC icon and name because the other properties shouldn't
|
||||
// be made public
|
||||
let config = {}
|
||||
config.oidcIcon = oidcConfig.config.iconName
|
||||
config.oidcName = oidcConfig.config.name
|
||||
oidcConfig.config = config
|
||||
ctx.body = oidcConfig
|
||||
}
|
||||
else if (publicConfig && oidcConfig) {
|
||||
ctx.body = publicConfig
|
||||
if (oidcConfig.config) {
|
||||
publicConfig.config.oidcIcon = oidcConfig.config.iconName
|
||||
publicConfig.config.oidcName = oidcConfig.config.name
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
ctx.throw(err.status, err)
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ const controller = require("../../controllers/admin/configs")
|
|||
const joiValidator = require("../../../middleware/joi-validator")
|
||||
const adminOnly = require("../../../middleware/adminOnly")
|
||||
const Joi = require("joi")
|
||||
const { Configs, ConfigUploads } = require("../../../constants")
|
||||
const { Configs } = require("../../../constants")
|
||||
|
||||
const router = Router()
|
||||
|
||||
|
@ -41,16 +41,14 @@ function googleValidation() {
|
|||
}).unknown(true)
|
||||
}
|
||||
|
||||
function OidcValidation() {
|
||||
function oidcValidation() {
|
||||
// prettier-ignore
|
||||
return Joi.object({
|
||||
clientID: Joi.string().required(),
|
||||
authUrl: Joi.string().required(),
|
||||
tokenUrl: Joi.string().required(),
|
||||
userInfoUrl: Joi.string().required(),
|
||||
clientId: Joi.string().required(),
|
||||
clientSecret: Joi.string().required(),
|
||||
callbackUrl: Joi.string().required(),
|
||||
configUrl: Joi.string().required(),
|
||||
iconName: Joi.string().required(),
|
||||
name: Joi.string().required(),
|
||||
}).unknown(true)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue