diff --git a/admin-panel/app/[lang]/dashboard/page.tsx b/admin-panel/app/[lang]/dashboard/page.tsx index b0e52ca..604c573 100644 --- a/admin-panel/app/[lang]/dashboard/page.tsx +++ b/admin-panel/app/[lang]/dashboard/page.tsx @@ -20,11 +20,20 @@ const Page = () => { name: t('dashboard.brandingConfigs'), value: [ 'COMPANY_LOGO_URL', - 'LAYOUT_COLOR', 'LABEL_COLOR', - 'PRIMARY_BUTTON_COLOR', 'PRIMARY_BUTTON_LABEL_COLOR', 'PRIMARY_BUTTON_BORDER_COLOR', - 'SECONDARY_BUTTON_COLOR', 'SECONDARY_BUTTON_LABEL_COLOR', 'SECONDARY_BUTTON_BORDER_COLOR', + 'FONT_FAMILY', + 'FONT_URL', + 'LAYOUT_COLOR', + 'LABEL_COLOR', + 'PRIMARY_BUTTON_COLOR', + 'PRIMARY_BUTTON_LABEL_COLOR', + 'PRIMARY_BUTTON_BORDER_COLOR', + 'SECONDARY_BUTTON_COLOR', + 'SECONDARY_BUTTON_LABEL_COLOR', + 'SECONDARY_BUTTON_BORDER_COLOR', 'CRITICAL_INDICATOR_COLOR', - 'EMAIL_SENDER_NAME', 'TERMS_LINK', 'PRIVACY_POLICY_LINK', + 'EMAIL_SENDER_NAME', + 'TERMS_LINK', + 'PRIVACY_POLICY_LINK', ], }, { @@ -33,19 +42,45 @@ const Page = () => { }, { name: t('dashboard.suppressionConfigs'), - value: ['ENABLE_NAMES', 'NAMES_IS_REQUIRED', 'ENABLE_SIGN_UP', 'ENABLE_PASSWORD_SIGN_IN', 'ENABLE_EMAIL_VERIFICATION', 'ENABLE_PASSWORD_RESET', 'PASSWORD_RESET_EMAIL_THRESHOLD', 'ENABLE_USER_APP_CONSENT'], + value: [ + 'ENABLE_NAMES', + 'NAMES_IS_REQUIRED', + 'ENABLE_SIGN_UP', + 'ENABLE_PASSWORD_SIGN_IN', + 'ENABLE_EMAIL_VERIFICATION', + 'ENABLE_PASSWORD_RESET', + 'ENABLE_USER_APP_CONSENT', + ], }, { name: t('dashboard.authConfigs'), - value: ['OTP_MFA_IS_REQUIRED', 'SMS_MFA_IS_REQUIRED', 'SMS_MFA_MESSAGE_THRESHOLD', 'EMAIL_MFA_IS_REQUIRED', 'EMAIL_MFA_EMAIL_THRESHOLD', 'CHANGE_EMAIL_EMAIL_THRESHOLD', 'ENFORCE_ONE_MFA_ENROLLMENT', 'ALLOW_EMAIL_MFA_AS_BACKUP', 'ACCOUNT_LOCKOUT_THRESHOLD', 'ACCOUNT_LOCKOUT_EXPIRES_IN', 'UNLOCK_ACCOUNT_VIA_PASSWORD_RESET'], + value: [ + 'AUTHORIZATION_CODE_EXPIRES_IN', + 'SPA_ACCESS_TOKEN_EXPIRES_IN', + 'SPA_REFRESH_TOKEN_EXPIRES_IN', + 'S2S_ACCESS_TOKEN_EXPIRES_IN', + 'ID_TOKEN_EXPIRES_IN', + 'SERVER_SESSION_EXPIRES_IN', + ], }, { name: t('dashboard.mfaConfigs'), - value: ['OTP_MFA_IS_REQUIRED', 'SMS_MFA_IS_REQUIRED', 'SMS_MFA_MESSAGE_THRESHOLD', 'EMAIL_MFA_IS_REQUIRED', 'EMAIL_MFA_EMAIL_THRESHOLD', 'CHANGE_EMAIL_EMAIL_THRESHOLD', 'ENFORCE_ONE_MFA_ENROLLMENT', 'ALLOW_EMAIL_MFA_AS_BACKUP'], + value: [ + 'OTP_MFA_IS_REQUIRED', + 'SMS_MFA_IS_REQUIRED', + 'EMAIL_MFA_IS_REQUIRED', + 'ENFORCE_ONE_MFA_ENROLLMENT', + 'ALLOW_EMAIL_MFA_AS_BACKUP', + ], }, { name: t('dashboard.bruteForceConfigs'), - value: ['ACCOUNT_LOCKOUT_THRESHOLD', 'ACCOUNT_LOCKOUT_EXPIRES_IN', 'UNLOCK_ACCOUNT_VIA_PASSWORD_RESET'], + value: [ + 'ACCOUNT_LOCKOUT_THRESHOLD', 'ACCOUNT_LOCKOUT_EXPIRES_IN', + 'UNLOCK_ACCOUNT_VIA_PASSWORD_RESET', 'PASSWORD_RESET_EMAIL_THRESHOLD', + 'ACCOUNT_LOCKOUT_THRESHOLD', 'EMAIL_MFA_EMAIL_THRESHOLD', + 'SMS_MFA_MESSAGE_THRESHOLD', + ], }, { name: t('dashboard.ssoConfigs'), diff --git a/docs/auth-server.md b/docs/auth-server.md index 297d2b8..1baf6f9 100644 --- a/docs/auth-server.md +++ b/docs/auth-server.md @@ -226,6 +226,14 @@ npm run prod:deploy - **Default:** https://raw.githubusercontent.com/ValueMelody/melody-homepage/main/logo.jpg - **Description:** The logo used for branding. +#### FONT_FAMILY +- **Default:** Inter +- **Description:** The font family on authentication pages. + +#### FONT_URL +- **Default:** https://fonts.googleapis.com/css2?family=Inter:wght@400..600&display=swap +- **Description:** Provides the URL to load the specified font (in this case, “Inter”) from Google Fonts, ensuring that the authentication pages have the appropriate font styles and weights applied. + #### LAYOUT_COLOR - **Default:** lightgray - **Description:** Specifies the background color of the layout on authentication pages. diff --git a/server/src/__tests__/normal/other.test.tsx b/server/src/__tests__/normal/other.test.tsx index 15edbaf..cf47a97 100644 --- a/server/src/__tests__/normal/other.test.tsx +++ b/server/src/__tests__/normal/other.test.tsx @@ -46,6 +46,8 @@ describe( SUPPORTED_LOCALES: ['en', 'fr'], ENABLE_LOCALE_SELECTOR: true, COMPANY_LOGO_URL: 'https://raw.githubusercontent.com/ValueMelody/melody-homepage/main/logo.jpg', + FONT_FAMILY: 'Inter', + FONT_URL: 'https://fonts.googleapis.com/css2?family=Inter:wght@400..600&display=swap', EMAIL_SENDER_NAME: 'Melody Auth', GOOGLE_AUTH_CLIENT_ID: '', FACEBOOK_AUTH_CLIENT_ID: '', diff --git a/server/src/configs/type.ts b/server/src/configs/type.ts index 35d0640..6a4c79f 100644 --- a/server/src/configs/type.ts +++ b/server/src/configs/type.ts @@ -35,6 +35,8 @@ export type Bindings = { ID_TOKEN_EXPIRES_IN: number; SERVER_SESSION_EXPIRES_IN: number; COMPANY_LOGO_URL: string; + FONT_FAMILY: string; + FONT_URL: string; LAYOUT_COLOR: string; LABEL_COLOR: string; PRIMARY_BUTTON_COLOR: string; diff --git a/server/src/handlers/other.ts b/server/src/handlers/other.ts index ee30eb4..04252bb 100644 --- a/server/src/handlers/other.ts +++ b/server/src/handlers/other.ts @@ -52,6 +52,8 @@ export const getSystemInfo = async (c: Context) => { ENABLE_SIGN_IN_LOG: environment.ENABLE_SIGN_IN_LOG, LAYOUT_COLOR: environment.LAYOUT_COLOR, LABEL_COLOR: environment.LABEL_COLOR, + FONT_FAMILY: environment.FONT_FAMILY, + FONT_URL: environment.FONT_URL, PRIMARY_BUTTON_COLOR: environment.PRIMARY_BUTTON_COLOR, PRIMARY_BUTTON_LABEL_COLOR: environment.PRIMARY_BUTTON_LABEL_COLOR, PRIMARY_BUTTON_BORDER_COLOR: environment.PRIMARY_BUTTON_BORDER_COLOR, diff --git a/server/src/services/branding.ts b/server/src/services/branding.ts index 6619ff4..2b38aeb 100644 --- a/server/src/services/branding.ts +++ b/server/src/services/branding.ts @@ -6,6 +6,8 @@ import { Branding } from 'views/components/Layout' export const getDefaultBranding = (c: Context): Branding => { const { COMPANY_LOGO_URL: logoUrl, + FONT_FAMILY: fontFamily, + FONT_URL: fontUrl, LAYOUT_COLOR: layoutColor, LABEL_COLOR: labelColor, PRIMARY_BUTTON_COLOR: primaryButtonColor, @@ -16,9 +18,10 @@ export const getDefaultBranding = (c: Context): Branding => SECONDARY_BUTTON_BORDER_COLOR: secondaryButtonBorderColor, CRITICAL_INDICATOR_COLOR: criticalIndicatorColor, } = env(c) - return { logoUrl, + fontFamily, + fontUrl, layoutColor, labelColor, primaryButtonColor, diff --git a/server/src/views/components/Layout.tsx b/server/src/views/components/Layout.tsx index 08bc862..2f5688b 100644 --- a/server/src/views/components/Layout.tsx +++ b/server/src/views/components/Layout.tsx @@ -8,6 +8,8 @@ import { export interface Branding { logoUrl: string; + fontFamily: string; + fontUrl: string; layoutColor: string; labelColor: string; primaryButtonColor: string; @@ -40,11 +42,11 @@ const Layout = ({ rel='preconnect' href='https://fonts.gstatic.com' />