fix some other auth bugs
This commit is contained in:
parent
227df203f9
commit
2cd309bfdc
|
@ -1,3 +1,5 @@
|
|||
import { get } from "builderStore/api";
|
||||
|
||||
/**
|
||||
* Fetches the definitions for component library components. This includes
|
||||
* their props and other metadata from components.json.
|
||||
|
@ -6,7 +8,7 @@
|
|||
export const fetchComponentLibDefinitions = async appId => {
|
||||
const LIB_DEFINITION_URL = `/${appId}/components/definitions`
|
||||
try {
|
||||
const libDefinitionResponse = await fetch(LIB_DEFINITION_URL)
|
||||
const libDefinitionResponse = await get(LIB_DEFINITION_URL)
|
||||
return await libDefinitionResponse.json()
|
||||
} catch (err) {
|
||||
console.error(`Error fetching component definitions for ${appId}`, err)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
}
|
||||
</script>
|
||||
|
||||
{#if panelDefinition.length > 0}
|
||||
{#if panelDefinition && panelDefinition.length > 0}
|
||||
{#each panelDefinition as definition}
|
||||
{#if propExistsOnComponentDef(definition.key)}
|
||||
<PropertyControl
|
||||
|
|
|
@ -317,7 +317,15 @@ export default {
|
|||
icon: "ri-bar-chart-fill",
|
||||
properties: {
|
||||
design: { ...all },
|
||||
settings: [{ label: "Model", key: "model", control: ModelSelect }],
|
||||
settings: [
|
||||
{ label: "Model", key: "model", control: ModelSelect },
|
||||
{
|
||||
label: "Chart Type",
|
||||
key: "type",
|
||||
control: OptionSelect,
|
||||
options: ["column2d", "password"],
|
||||
},
|
||||
],
|
||||
},
|
||||
children: [],
|
||||
},
|
||||
|
|
|
@ -27,6 +27,7 @@ export const bbFactory = ({
|
|||
method: method,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"x-user-agent": "Budibase Builder"
|
||||
},
|
||||
body: body && JSON.stringify(body),
|
||||
})
|
||||
|
|
|
@ -10,13 +10,9 @@ exports.authenticate = async ctx => {
|
|||
if (!username) ctx.throw(400, "Username Required.")
|
||||
if (!password) ctx.throw(400, "Password Required")
|
||||
|
||||
// TODO: Don't use this. It can't be relied on
|
||||
const referer = ctx.request.headers.referer.split("/")
|
||||
const appId = referer[3]
|
||||
|
||||
// find the instance that the user is associated with
|
||||
const db = new CouchDB(ClientDb.name(env.CLIENT_ID))
|
||||
const app = await db.get(appId)
|
||||
const app = await db.get(ctx.params.appId)
|
||||
const instanceId = app.userInstanceMap[username]
|
||||
|
||||
if (!instanceId)
|
||||
|
|
|
@ -3,6 +3,6 @@ const controller = require("../controllers/auth")
|
|||
|
||||
const router = Router()
|
||||
|
||||
router.post("/api/authenticate", controller.authenticate)
|
||||
router.post("/:appId/api/authenticate", controller.authenticate)
|
||||
|
||||
module.exports = router
|
||||
|
|
Loading…
Reference in New Issue