diff --git a/packages/account-portal b/packages/account-portal index e46a352a63..c764a88325 160000 --- a/packages/account-portal +++ b/packages/account-portal @@ -1 +1 @@ -Subproject commit e46a352a6326a838faa00f912de069aee95d7300 +Subproject commit c764a88325b7ecd55aeff2140eab08fe9b32dac7 diff --git a/packages/backend-core/src/index.ts b/packages/backend-core/src/index.ts index d04f48e5fc..32213a9310 100644 --- a/packages/backend-core/src/index.ts +++ b/packages/backend-core/src/index.ts @@ -38,6 +38,7 @@ export * as docIds from "./docIds" // circular dependencies import * as context from "./context" import * as _tenancy from "./tenancy" +export * as security from "./security" export const tenancy = { ..._tenancy, diff --git a/packages/backend-core/src/security/auth.ts b/packages/backend-core/src/security/auth.ts new file mode 100644 index 0000000000..60fe72947b --- /dev/null +++ b/packages/backend-core/src/security/auth.ts @@ -0,0 +1,11 @@ +const MIN_LENGTH = 8 + +export function validatePassword( + password: string +): { valid: true } | { valid: false; error: string } { + if (password?.length < MIN_LENGTH) { + return { valid: false, error: "Password invalid. Minimum eight characters" } + } + + return { valid: true } +} diff --git a/packages/backend-core/src/security/index.ts b/packages/backend-core/src/security/index.ts new file mode 100644 index 0000000000..306751af96 --- /dev/null +++ b/packages/backend-core/src/security/index.ts @@ -0,0 +1 @@ +export * from "./auth"