diff --git a/packages/core/src/__mocks__/sign-in-experience.ts b/packages/core/src/__mocks__/sign-in-experience.ts index 1c4eb8618..37cbff29a 100644 --- a/packages/core/src/__mocks__/sign-in-experience.ts +++ b/packages/core/src/__mocks__/sign-in-experience.ts @@ -92,6 +92,7 @@ export const mockSignInExperience: SignInExperience = { customCss: null, customContent: {}, agreeToTermsPolicy: AgreeToTermsPolicy.Automatic, + customUiAssetId: null, passwordPolicy: {}, mfa: { policy: MfaPolicy.UserControlled, diff --git a/packages/core/src/queries/sign-in-experience.test.ts b/packages/core/src/queries/sign-in-experience.test.ts index 4c4de7e04..f9e5c9daa 100644 --- a/packages/core/src/queries/sign-in-experience.test.ts +++ b/packages/core/src/queries/sign-in-experience.test.ts @@ -40,7 +40,7 @@ describe('sign-in-experience query', () => { it('findDefaultSignInExperience', async () => { /* eslint-disable sql/no-unsafe-query */ const expectSql = ` - select "tenant_id", "id", "color", "branding", "language_info", "terms_of_use_url", "privacy_policy_url", "agree_to_terms_policy", "sign_in", "sign_up", "social_sign_in", "social_sign_in_connector_targets", "sign_in_mode", "custom_css", "custom_content", "password_policy", "mfa", "single_sign_on_enabled" + select "tenant_id", "id", "color", "branding", "language_info", "terms_of_use_url", "privacy_policy_url", "agree_to_terms_policy", "sign_in", "sign_up", "social_sign_in", "social_sign_in_connector_targets", "sign_in_mode", "custom_css", "custom_content", "custom_ui_asset_id", "password_policy", "mfa", "single_sign_on_enabled" from "sign_in_experiences" where "id"=$1 `; diff --git a/packages/experience/src/__mocks__/logto.tsx b/packages/experience/src/__mocks__/logto.tsx index 6aa40a6eb..58219f6e6 100644 --- a/packages/experience/src/__mocks__/logto.tsx +++ b/packages/experience/src/__mocks__/logto.tsx @@ -106,6 +106,7 @@ export const mockSignInExperience: SignInExperience = { customCss: null, customContent: {}, agreeToTermsPolicy: AgreeToTermsPolicy.ManualRegistrationOnly, + customUiAssetId: null, passwordPolicy: {}, mfa: { policy: MfaPolicy.UserControlled, @@ -139,6 +140,7 @@ export const mockSignInExperienceSettings: SignInExperienceResponse = { customCss: null, customContent: {}, agreeToTermsPolicy: mockSignInExperience.agreeToTermsPolicy, + customUiAssetId: null, passwordPolicy: {}, mfa: { policy: MfaPolicy.UserControlled, diff --git a/packages/schemas/alterations/next-1719312694-custom-ui-assets.ts b/packages/schemas/alterations/next-1719312694-custom-ui-assets.ts new file mode 100644 index 000000000..9d7638a75 --- /dev/null +++ b/packages/schemas/alterations/next-1719312694-custom-ui-assets.ts @@ -0,0 +1,18 @@ +import { sql } from '@silverhand/slonik'; + +import type { AlterationScript } from '../lib/types/alteration.js'; + +const alteration: AlterationScript = { + up: async (pool) => { + await pool.query(sql` + alter table sign_in_experiences add column custom_ui_asset_id varchar(21); + `); + }, + down: async (pool) => { + await pool.query(sql` + alter table sign_in_experiences drop column custom_ui_asset_id; + `); + }, +}; + +export default alteration; diff --git a/packages/schemas/src/seeds/sign-in-experience.ts b/packages/schemas/src/seeds/sign-in-experience.ts index e875ff29f..d7217af52 100644 --- a/packages/schemas/src/seeds/sign-in-experience.ts +++ b/packages/schemas/src/seeds/sign-in-experience.ts @@ -49,6 +49,7 @@ export const createDefaultSignInExperience = ( signInMode: SignInMode.SignInAndRegister, customCss: null, customContent: {}, + customUiAssetId: null, passwordPolicy: {}, mfa: { factors: [], diff --git a/packages/schemas/tables/sign_in_experiences.sql b/packages/schemas/tables/sign_in_experiences.sql index d1e17c427..b9f078103 100644 --- a/packages/schemas/tables/sign_in_experiences.sql +++ b/packages/schemas/tables/sign_in_experiences.sql @@ -19,6 +19,7 @@ create table sign_in_experiences ( sign_in_mode sign_in_mode not null default 'SignInAndRegister', custom_css text, custom_content jsonb /* @use CustomContent */ not null default '{}'::jsonb, + custom_ui_asset_id varchar(21), password_policy jsonb /* @use PartialPasswordPolicy */ not null default '{}'::jsonb, mfa jsonb /* @use Mfa */ not null default '{}'::jsonb, single_sign_on_enabled boolean not null default false,