Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

handle defaults for custom branding when unspecified

Scott Wilson4670baf42d82
diff --git a/frontend/src/pages/public/ViewSecretRequestByIDPage/ViewSecretRequestByIDPage.tsx b/frontend/src/pages/public/ViewSecretRequestByIDPage/ViewSecretRequestByIDPage.tsx
index 9c8e1243ce..bd949d5142 100644
--- a/frontend/src/pages/public/ViewSecretRequestByIDPage/ViewSecretRequestByIDPage.tsx
+++ b/frontend/src/pages/public/ViewSecretRequestByIDPage/ViewSecretRequestByIDPage.tsx
@@ -22,6 +22,8 @@ import { TBrandingConfig, useGetSecretRequestById } from "@app/hooks/api/secretS
import {
adjustColor,
+ DEFAULT_BRAND_PRIMARY_COLOR,
+ DEFAULT_BRAND_SECONDARY_COLOR,
DEFAULT_FAVICON_URL,
isLightColor
} from "../ViewSharedSecretByIDPage/ViewSharedSecretByIDPage";
@@ -104,12 +106,15 @@ export const ViewSecretRequestByIDPage = () => {
: DEFAULT_FAVICON_URL;
const brandingTheme = useMemo(() => {
- if (!brandingConfig?.primaryColor) {
+ if (!hasCustomBranding) {
return undefined;
}
- const primary = brandingConfig.primaryColor;
- const secondary = brandingConfig.secondaryColor || primary;
+ const primary = brandingConfig?.primaryColor || DEFAULT_BRAND_PRIMARY_COLOR;
+ const secondary =
+ brandingConfig?.secondaryColor ||
+ brandingConfig?.primaryColor ||
+ DEFAULT_BRAND_SECONDARY_COLOR;
const isSecondaryLight = isLightColor(secondary);
return {
@@ -122,7 +127,7 @@ export const ViewSecretRequestByIDPage = () => {
inputBg: adjustColor(secondary, isSecondaryLight ? -15 : 15),
buttonBg: secondary
};
- }, [brandingConfig?.primaryColor, brandingConfig?.secondaryColor]);
+ }, [hasCustomBranding, brandingConfig?.primaryColor, brandingConfig?.secondaryColor]);
const backgroundStyle = useMemo(() => {
if (!brandingTheme) {
diff --git a/frontend/src/pages/public/ViewSharedSecretByIDPage/ViewSharedSecretByIDPage.tsx b/frontend/src/pages/public/ViewSharedSecretByIDPage/ViewSharedSecretByIDPage.tsx
index 44797b0187..8f82839011 100644
--- a/frontend/src/pages/public/ViewSharedSecretByIDPage/ViewSharedSecretByIDPage.tsx
+++ b/frontend/src/pages/public/ViewSharedSecretByIDPage/ViewSharedSecretByIDPage.tsx
@@ -24,6 +24,8 @@ import {
export const DEFAULT_LOGO_URL = "/images/gradientLogo.svg";
export const DEFAULT_FAVICON_URL = "/infisical.ico";
+export const DEFAULT_BRAND_PRIMARY_COLOR = "#0e1014";
+export const DEFAULT_BRAND_SECONDARY_COLOR = "#1e1f22";
// Returns true if the color is considered "light"
export const isLightColor = (hexColor: string): boolean => {
@@ -147,12 +149,15 @@ export const ViewSharedSecretByIDPage = () => {
: DEFAULT_FAVICON_URL;
const brandingTheme = useMemo((): BrandingTheme | undefined => {
- if (!brandingConfig?.primaryColor) {
+ if (!hasCustomBranding) {
return undefined;
}
- const primary = brandingConfig.primaryColor;
- const secondary = brandingConfig.secondaryColor || primary;
+ const primary = brandingConfig?.primaryColor || DEFAULT_BRAND_PRIMARY_COLOR;
+ const secondary =
+ brandingConfig?.secondaryColor ||
+ brandingConfig?.primaryColor ||
+ DEFAULT_BRAND_SECONDARY_COLOR;
const isSecondaryLight = isLightColor(secondary);
return {
@@ -165,7 +170,7 @@ export const ViewSharedSecretByIDPage = () => {
inputBg: adjustColor(secondary, isSecondaryLight ? -15 : 15),
buttonBg: secondary
};
- }, [brandingConfig?.primaryColor, brandingConfig?.secondaryColor]);
+ }, [hasCustomBranding, brandingConfig?.primaryColor, brandingConfig?.secondaryColor]);
const backgroundStyle = useMemo(() => {
if (!brandingTheme) {