0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-01-06 20:40:08 -05:00

refactor: update initial data (#3534)

This commit is contained in:
Gao Sun 2023-03-20 16:08:44 +08:00 committed by GitHub
parent 497f244858
commit c2e4226292
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 13 deletions

View file

@ -25,7 +25,7 @@ export const seedByPool = async (pool: DatabasePool, cloud = false) => {
text: 'Create tables',
prefixText: chalk.blue('[info]'),
});
await seedTables(connection, latestTimestamp);
await seedTables(connection, latestTimestamp, cloud);
if (cloud) {
await seedCloud(connection);

View file

@ -117,7 +117,8 @@ export const createTables = async (connection: DatabaseTransactionConnection) =>
export const seedTables = async (
connection: DatabaseTransactionConnection,
latestTimestamp: number
latestTimestamp: number,
isCloud: boolean
) => {
await createTenant(connection, defaultTenantId);
await seedOidcConfigs(connection, defaultTenantId);
@ -164,7 +165,7 @@ export const seedTables = async (
await Promise.all([
connection.query(insertInto(createDefaultAdminConsoleConfig(defaultTenantId), 'logto_configs')),
connection.query(
insertInto(createDefaultSignInExperience(defaultTenantId), 'sign_in_experiences')
insertInto(createDefaultSignInExperience(defaultTenantId, isCloud), 'sign_in_experiences')
),
connection.query(insertInto(createDefaultAdminConsoleConfig(adminTenantId), 'logto_configs')),
connection.query(insertInto(createAdminTenantSignInExperience(), 'sign_in_experiences')),

View file

@ -113,7 +113,7 @@ export class TenantsLibrary {
),
transaction.query(insertInto(createDefaultAdminConsoleConfig(tenantId), LogtoConfigs.table)),
transaction.query(
insertInto(createDefaultSignInExperience(tenantId), SignInExperiences.table)
insertInto(createDefaultSignInExperience(tenantId, true), SignInExperiences.table)
),
]);

View file

@ -1,7 +1,7 @@
import { useTranslation } from 'react-i18next';
import TextLink from '@/components/TextLink';
import { logtoBlogLink } from '@/onboarding/constants';
import { aboutCloudPreviewLink } from '@/onboarding/constants';
import * as styles from './index.module.scss';
@ -11,7 +11,7 @@ const Broadcast = () => {
return (
<div className={styles.broadcast}>
<span>{t('cloud.broadcast')}</span>
<TextLink href={logtoBlogLink} target="_blank" className={styles.link}>
<TextLink href={aboutCloudPreviewLink} target="_blank" className={styles.link}>
{t('general.learn_more')}
</TextLink>
</div>

View file

@ -1,2 +1,3 @@
export const reservationLink = 'https://calendly.com/logto/30min';
export const logtoBlogLink = 'https://docs.logto.io/blog?utm_source=console';
export const aboutCloudPreviewLink = 'https://docs.logto.io/about/cloud-preview?utm_source=console';

View file

@ -7,7 +7,10 @@ import { adminTenantId, defaultTenantId } from './tenant.js';
const defaultPrimaryColor = '#6139F6';
export const createDefaultSignInExperience = (forTenantId: string): Readonly<SignInExperience> =>
export const createDefaultSignInExperience = (
forTenantId: string,
isCloud: boolean
): Readonly<SignInExperience> =>
Object.freeze({
tenantId: forTenantId,
id: 'default',
@ -17,8 +20,8 @@ export const createDefaultSignInExperience = (forTenantId: string): Readonly<Sig
darkPrimaryColor: generateDarkColor(defaultPrimaryColor),
},
branding: {
logoUrl: 'https://logto.io/logo.svg',
darkLogoUrl: 'https://logto.io/logo-dark.svg',
logoUrl: isCloud ? '' : 'https://logto.io/logo.svg',
darkLogoUrl: isCloud ? '' : 'https://logto.io/logo-dark.svg',
},
languageInfo: {
autoDetect: true,
@ -27,14 +30,14 @@ export const createDefaultSignInExperience = (forTenantId: string): Readonly<Sig
termsOfUseUrl: null,
privacyPolicyUrl: null,
signUp: {
identifiers: [SignInIdentifier.Username],
identifiers: [isCloud ? SignInIdentifier.Email : SignInIdentifier.Username],
password: true,
verify: false,
verify: isCloud,
},
signIn: {
methods: [
{
identifier: SignInIdentifier.Username,
identifier: isCloud ? SignInIdentifier.Email : SignInIdentifier.Username,
password: true,
verificationCode: false,
isPasswordPrimary: true,
@ -48,7 +51,7 @@ export const createDefaultSignInExperience = (forTenantId: string): Readonly<Sig
});
/** @deprecated Use `createDefaultSignInExperience()` instead. */
export const defaultSignInExperience = createDefaultSignInExperience(defaultTenantId);
export const defaultSignInExperience = createDefaultSignInExperience(defaultTenantId, false);
export const createAdminTenantSignInExperience = (): Readonly<SignInExperience> =>
Object.freeze({