diff --git a/packages/backend-core/src/security/auth.ts b/packages/backend-core/src/security/auth.ts index 1cce35a0af..7dacecdb3b 100644 --- a/packages/backend-core/src/security/auth.ts +++ b/packages/backend-core/src/security/auth.ts @@ -1,6 +1,6 @@ import env from "../environment" -export const PASSWORD_MIN_LENGTH = +(env.PASSWORD_MIN_LENGTH || 8) +export const PASSWORD_MIN_LENGTH = +(env.PASSWORD_MIN_LENGTH || 12) export const PASSWORD_MAX_LENGTH = +(env.PASSWORD_MAX_LENGTH || 512) export function validatePassword( diff --git a/packages/backend-core/src/security/tests/auth.spec.ts b/packages/backend-core/src/security/tests/auth.spec.ts index b1835fdfb3..78e25b0a81 100644 --- a/packages/backend-core/src/security/tests/auth.spec.ts +++ b/packages/backend-core/src/security/tests/auth.spec.ts @@ -4,7 +4,7 @@ import { PASSWORD_MAX_LENGTH, validatePassword } from "../auth" describe("auth", () => { describe("validatePassword", () => { it("a valid password returns successful", () => { - expect(validatePassword("password")).toEqual({ valid: true }) + expect(validatePassword("password123!")).toEqual({ valid: true }) }) it.each([ @@ -14,7 +14,7 @@ describe("auth", () => { ])("%s returns unsuccessful", (_, password) => { expect(validatePassword(password as string)).toEqual({ valid: false, - error: "Password invalid. Minimum 8 characters.", + error: "Password invalid. Minimum 12 characters.", }) }) diff --git a/packages/backend-core/tests/core/utilities/structures/users.ts b/packages/backend-core/tests/core/utilities/structures/users.ts index db90887af2..0171353e23 100644 --- a/packages/backend-core/tests/core/utilities/structures/users.ts +++ b/packages/backend-core/tests/core/utilities/structures/users.ts @@ -21,7 +21,7 @@ export const user = (userProps?: Partial>): User => { _id: userId, userId, email: newEmail(), - password: "password", + password: "password123!", roles: { app_test: "admin" }, firstName: generator.first(), lastName: generator.last(), diff --git a/packages/bbui/src/Form/Core/Select.svelte b/packages/bbui/src/Form/Core/Select.svelte index 3806281438..7d325bb6cc 100644 --- a/packages/bbui/src/Form/Core/Select.svelte +++ b/packages/bbui/src/Form/Core/Select.svelte @@ -102,7 +102,9 @@ {onOptionMouseenter} {onOptionMouseleave} isPlaceholder={value == null || value === ""} - placeholderOption={placeholder === false ? null : placeholder} + placeholderOption={placeholder === false + ? null + : placeholder || "Choose an option"} isOptionSelected={option => compareOptionAndValue(option, value)} onSelectOption={selectOption} {loading} diff --git a/packages/builder/src/components/automation/SetupPanel/RowSelectorTypes.svelte b/packages/builder/src/components/automation/SetupPanel/RowSelectorTypes.svelte index 85d57e665a..ee9fd12c0c 100644 --- a/packages/builder/src/components/automation/SetupPanel/RowSelectorTypes.svelte +++ b/packages/builder/src/components/automation/SetupPanel/RowSelectorTypes.svelte @@ -157,7 +157,7 @@ {:else if schema.type === "link"} onChange({ @@ -169,7 +169,7 @@ /> {:else if schema.type === "bb_reference" || schema.type === "bb_reference_single"} diff --git a/packages/builder/src/components/backend/DataTable/RowFieldControl.svelte b/packages/builder/src/components/backend/DataTable/RowFieldControl.svelte index b012766171..745f29d56a 100644 --- a/packages/builder/src/components/backend/DataTable/RowFieldControl.svelte +++ b/packages/builder/src/components/backend/DataTable/RowFieldControl.svelte @@ -146,7 +146,7 @@ {:else if type === "link"} (value = e.detail)} /> diff --git a/packages/builder/src/components/common/LinkedRowSelector.svelte b/packages/builder/src/components/common/LinkedRowSelector.svelte index 8db4a7dc03..009d943456 100644 --- a/packages/builder/src/components/common/LinkedRowSelector.svelte +++ b/packages/builder/src/components/common/LinkedRowSelector.svelte @@ -6,7 +6,7 @@ import { createEventDispatcher } from "svelte" export let schema - export let linkedRows = [] + export let linkedData export let useLabel = true export let linkedTableId export let label @@ -15,14 +15,26 @@ let rows = [] let linkedIds = [] - $: linkedIds = (Array.isArray(linkedRows) ? linkedRows : [])?.map( - row => row?._id || row - ) + $: fieldValue = getFieldValue(linkedData, schema) $: label = label || capitalise(schema.name) $: linkedTableId = linkedTableId || schema.tableId $: linkedTable = $tables.list.find(table => table._id === linkedTableId) $: fetchRows(linkedTableId) + const getFieldValue = val => { + const linkedIds = (Array.isArray(val) ? val : [])?.map( + row => row?._id || row + ) + if ( + schema.relationshipType === "one-to-many" || + schema.type === "bb_reference_single" + ) { + return linkedIds[0] + } else { + return linkedIds + } + } + async function fetchRows(linkedTableId) { try { rows = await API.fetchTableData(linkedTableId) @@ -45,7 +57,7 @@ {:else if schema.relationshipType === "one-to-many" || schema.type === "bb_reference_single"}