Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
request secret page branding
x032205a4dd1214ccd4
diff --git a/backend/src/server/routes/v1/secret-requests-router.ts b/backend/src/server/routes/v1/secret-requests-router.tsindex 1bd044d647..aaf75c4f3d 100644--- a/backend/src/server/routes/v1/secret-requests-router.ts+++ b/backend/src/server/routes/v1/secret-requests-router.ts@@ -2,8 +2,9 @@ import { z } from "zod";import { SecretSharingSchema } from "@app/db/schemas";import { EventType } from "@app/ee/services/audit-log/audit-log-types";+import { NotFoundError } from "@app/lib/errors";import { SecretSharingAccessType } from "@app/lib/types";-import { readLimit, writeLimit } from "@app/server/config/rateLimiter";+import { publicEndpointLimit, readLimit, writeLimit } from "@app/server/config/rateLimiter";import { getTelemetryDistinctId } from "@app/server/lib/telemetry";import { verifyAuth } from "@app/server/plugins/auth/verify-auth";import { AuthMode } from "@app/services/auth/auth-type";@@ -23,20 +24,31 @@ export const registerSecretRequestsRouter = async (server: FastifyZodProvider) =}),response: {200: z.object({- secretRequest: SecretSharingSchema.omit({+ request: SecretSharingSchema.omit({encryptedSecret: true,tag: true,iv: true,encryptedValue: true- }).extend({- isSecretValueSet: z.boolean(),- requester: z.object({- organizationName: z.string(),- firstName: z.string().nullish(),- lastName: z.string().nullish(),- username: z.string()- })})+ .extend({+ requester: z.object({+ organizationName: z.string(),+ firstName: z.string().nullish(),+ lastName: z.string().nullish(),+ username: z.string()+ })+ })+ .optional(),+ brandingConfig: z+ .object({+ hasLogo: z.boolean(),+ hasFavicon: z.boolean(),+ primaryColor: z.string().optional(),+ secondaryColor: z.string().optional()+ })+ .optional(),+ error: z.string().optional(),+ isSecretValueSet: z.boolean()})}},@@ -49,7 +61,55 @@ export const registerSecretRequestsRouter = async (server: FastifyZodProvider) =actorAuthMethod: req.permission?.authMethod});- return { secretRequest };+ let brandingConfig;+ if (secretRequest.requestOrgId) {+ const orgBrandConfig = await req.server.services.secretSharing.getOrgBrandConfig(secretRequest.requestOrgId);+ if (orgBrandConfig) {+ brandingConfig = {+ hasLogo: orgBrandConfig.hasLogo,+ hasFavicon: orgBrandConfig.hasFavicon,+ primaryColor: orgBrandConfig.primaryColor,+ secondaryColor: orgBrandConfig.secondaryColor+ };+ }+ }++ return { ...secretRequest, brandingConfig };+ }+ });++ // Endpoint to serve branding images for secret requests+ server.route({+ method: "GET",+ url: "/:id/branding/:assetType",+ config: {+ rateLimit: publicEndpointLimit+ },+ schema: {+ params: z.object({+ id: z.string(),+ assetType: z.enum(["logo", "favicon"])+ })+ },+ handler: async (req, res) => {+ const { id, assetType } = req.params;++ const orgId = await req.server.services.secretSharing.getSecretRequestOrgId(id);++ if (!orgId) {+ throw new NotFoundError({ message: "Secret request not found or has no organization" });+ }++ const asset = await req.server.services.secretSharing.getBrandingAsset(orgId, assetType);++ if (!asset) {+ throw new NotFoundError({ message: `No ${assetType} configured for this organization` });+ }++ void res.header("Content-Type", asset.contentType);+ void res.header("Cache-Control", "public, max-age=3600"); // Cache for 1 hour++ return res.send(asset.data);}});diff --git a/backend/src/services/secret-sharing/secret-sharing-service.ts b/backend/src/services/secret-sharing/secret-sharing-service.tsindex 66705be0e8..177bcdbf12 100644--- a/backend/src/services/secret-sharing/secret-sharing-service.ts+++ b/backend/src/services/secret-sharing/secret-sharing-service.ts@@ -1,4 +1,7 @@+import { ForbiddenError } from "@casl/ability";+import { OrganizationActionScope, TSecretSharing } from "@app/db/schemas";+import { OrgPermissionSecretShareAction, OrgPermissionSubjects } from "@app/ee/services/permission/org-permission";import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service-types";import { getConfig } from "@app/lib/config/env";import { crypto } from "@app/lib/crypto/cryptography";@@ -9,6 +12,7 @@ import { isUuidV4 } from "@app/lib/validator";import { TKmsServiceFactory } from "../kms/kms-service";import { TOrgDALFactory } from "../org/org-dal";+import { TSecretShareBrandConfig } from "../org/org-types";import { SmtpTemplates, TSmtpService } from "../smtp/smtp-service";import { TUserDALFactory } from "../user/user-dal";import { TSecretShareBrandingAssetDALFactory } from "./secret-share-branding-asset-dal";@@ -25,9 +29,6 @@ import {TRevealSecretRequestValueDTO,TSetSecretRequestValueDTO} from "./secret-sharing-types";-import { ForbiddenError } from "@casl/ability";-import { OrgPermissionSecretShareAction, OrgPermissionSubjects } from "@app/ee/services/permission/org-permission";-import { TSecretShareBrandConfig } from "../org/org-types";type TSecretSharingServiceFactoryDep = {permissionService: Pick<TPermissionServiceFactory, "getOrgPermission">;@@ -314,17 +315,25 @@ export const secretSharingServiceFactory = ({}if (secretRequest.expiresAt && secretRequest.expiresAt < new Date()) {- throw new ForbiddenRequestError({- message: "Access denied: Secret request has expired"- });+ return {+ requestOrgId: secretRequest.orgId,+ error: "Secret request has expired",+ isSecretValueSet: false+ };}return {- ...secretRequest,+ request: secretRequest,+ requestOrgId: secretRequest.orgId,isSecretValueSet: Boolean(secretRequest.encryptedSecret)};};+ const getSecretRequestOrgId = async (secretRequestId: string) => {+ const secretRequest = await secretSharingDAL.getSecretRequestById(secretRequestId);+ return secretRequest?.orgId ?? null;+ };+const setSecretRequestValue = async ({id,actor,@@ -772,6 +781,7 @@ export const secretSharingServiceFactory = ({createSecretRequest,getSecretRequestById,+ getSecretRequestOrgId,setSecretRequestValue,revealSecretRequestValue};diff --git a/frontend/src/components/v2/TextArea/TextArea.tsx b/frontend/src/components/v2/TextArea/TextArea.tsxindex ca366cea96..e6ae05350f 100644--- a/frontend/src/components/v2/TextArea/TextArea.tsx+++ b/frontend/src/components/v2/TextArea/TextArea.tsx@@ -64,12 +64,12 @@ export const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(ref): JSX.Element => (<textarea- {...props}style={{ resize: reSize }}required={isRequired}ref={ref}disabled={isDisabled}className={twMerge(textAreaVariants({ className, isError, size, isRounded, variant }))}+ {...props}/>));diff --git a/frontend/src/hooks/api/secretSharing/queries.ts b/frontend/src/hooks/api/secretSharing/queries.tsindex cdd1edf2a2..7c8d91de85 100644--- a/frontend/src/hooks/api/secretSharing/queries.ts+++ b/frontend/src/hooks/api/secretSharing/queries.ts@@ -111,7 +111,7 @@ export const useGetSecretRequestById = ({ secretRequestId }: { secretRequestId:`/api/v1/secret-sharing/requests/${secretRequestId}`);- return data.secretRequest;+ return data;}});};diff --git a/frontend/src/hooks/api/secretSharing/types.ts b/frontend/src/hooks/api/secretSharing/types.tsindex 497a0c22c3..dab6e6b0c1 100644--- a/frontend/src/hooks/api/secretSharing/types.ts+++ b/frontend/src/hooks/api/secretSharing/types.ts@@ -76,8 +76,9 @@ export type TViewSharedSecretResponse = {};export type TGetSecretRequestByIdResponse = {- secretRequest: {- isSecretValueSet: boolean;+ request: {+ id: string;+ orgId: string;accessType: SecretSharingAccessType;requester: {organizationName: string;@@ -86,6 +87,9 @@ export type TGetSecretRequestByIdResponse = {lastName?: string;};};+ brandingConfig?: TBrandingConfig;+ isSecretValueSet: boolean;+ error?: string;};export type TDeleteSharedSecretRequestDTO = {diff --git a/frontend/src/pages/public/ViewSecretRequestByIDPage/ViewSecretRequestByIDPage.tsx b/frontend/src/pages/public/ViewSecretRequestByIDPage/ViewSecretRequestByIDPage.tsxindex 011d6d20d3..115adce062 100644--- a/frontend/src/pages/public/ViewSecretRequestByIDPage/ViewSecretRequestByIDPage.tsx+++ b/frontend/src/pages/public/ViewSecretRequestByIDPage/ViewSecretRequestByIDPage.tsx@@ -1,16 +1,24 @@-import { useEffect, useState } from "react";+import { useEffect, useMemo, useState } from "react";import { Helmet } from "react-helmet";import { faArrowRight } from "@fortawesome/free-solid-svg-icons";import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { useNavigate, useParams } from "@tanstack/react-router";import { AxiosError } from "axios";import { addSeconds, formatISO } from "date-fns";+import { twMerge } from "tailwind-merge";import { createNotification } from "@app/components/notifications";+import { Lottie } from "@app/components/v2";import { SessionStorageKeys } from "@app/const";import { ROUTE_PATHS } from "@app/const/routes";-import { useGetSecretRequestById } from "@app/hooks/api/secretSharing";+import { TBrandingConfig, useGetSecretRequestById } from "@app/hooks/api/secretSharing";+import {+ adjustColor,+ DEFAULT_FAVICON_URL,+ DEFAULT_LOGO_URL,+ isLightColor+} from "../ViewSharedSecretByIDPage/ViewSharedSecretByIDPage";import { SecretRequestErrorContainer } from "./components/SecretErrorContainer";import { SecretRequestContainer } from "./components/SecretRequestContainer";import { SecretRequestSuccessContainer } from "./components/SecretRequestSuccessContainer";@@ -24,6 +32,9 @@ export const ViewSecretRequestByIDPage = () => {const [step, setStep] = useState<"set-value" | "success">("set-value");+ // Store branding config separately so it persists across errors+ const [savedBrandingConfig, setSavedBrandingConfig] = useState<TBrandingConfig | undefined>();+const {data: secretRequest,error,@@ -41,6 +52,13 @@ export const ViewSecretRequestByIDPage = () => {const isForbidden = statusCode === 403;const isInvalidCredential = message === "Invalid credentials";+ // Save branding config separately so it persists across errors+ useEffect(() => {+ if (secretRequest?.brandingConfig) {+ setSavedBrandingConfig(secretRequest.brandingConfig);+ }+ }, [secretRequest?.brandingConfig]);+useEffect(() => {if (isUnauthorized && !isInvalidCredential) {// persist current URL in session storage so that we can come back to this after successful login@@ -70,114 +88,239 @@ export const ViewSecretRequestByIDPage = () => {}}, [error]);+ const brandingConfig = secretRequest?.brandingConfig || savedBrandingConfig;+ const hasCustomBranding = !!brandingConfig;++ const logoUrl = brandingConfig?.hasLogo+ ? `/api/v1/secret-sharing/requests/${id}/branding/logo`+ : DEFAULT_LOGO_URL;+ const faviconUrl = brandingConfig?.hasFavicon+ ? `/api/v1/secret-sharing/requests/${id}/branding/favicon`+ : DEFAULT_FAVICON_URL;++ const brandingTheme = useMemo(() => {+ if (!brandingConfig?.primaryColor) {+ return undefined;+ }++ const primary = brandingConfig.primaryColor;+ const secondary = brandingConfig.secondaryColor || primary;+ const isSecondaryLight = isLightColor(secondary);++ return {+ primaryColor: primary,+ secondaryColor: secondary,+ // Text colors based on secondary brightness (for components)+ textColor: isSecondaryLight ? "#1a1a1a" : "#f5f5f5",+ textMutedColor: isSecondaryLight ? "#1a1a1acc" : "#f5f5f5cc",+ // Panel and components based on secondary color+ panelBg: secondary,+ panelBorder: adjustColor(secondary, isSecondaryLight ? -30 : 30),+ inputBg: adjustColor(secondary, isSecondaryLight ? -15 : 15),+ buttonBg: secondary+ };+ }, [brandingConfig?.primaryColor, brandingConfig?.secondaryColor]);++ const backgroundStyle = useMemo(() => {+ if (!brandingTheme) {+ return undefined;+ }++ const isPrimaryLight = isLightColor(brandingTheme.primaryColor);+ const gradientStart = adjustColor(brandingTheme.primaryColor, isPrimaryLight ? -20 : 20);++ return {+ backgroundImage: `linear-gradient(to bottom right, ${gradientStart}, ${brandingTheme.primaryColor})`,+ backgroundAttachment: "fixed"+ } as React.CSSProperties;+ }, [brandingTheme]);++ useEffect(() => {+ if (!faviconUrl) return undefined;++ const existingLink = document.querySelector("link[rel='icon']") as HTMLLinkElement | null;+ const originalHref = existingLink?.href;++ if (existingLink) {+ existingLink.href = faviconUrl;+ } else {+ const link = document.createElement("link");+ link.rel = "icon";+ link.href = faviconUrl;+ document.head.appendChild(link);+ }++ return () => {+ if (existingLink && originalHref) {+ existingLink.href = originalHref;+ }+ };+ }, [faviconUrl]);++ if (isPending) {+ return (+ <div className="flex h-screen w-screen items-center justify-center bg-bunker-800">+ <Lottie isAutoPlay icon="infisical_loading" className="h-32 w-32" />+ </div>+ );+ }+return (<><Helmet>- <title>Securely Share Secrets | Infisical</title>- <link rel="icon" href="/infisical.ico" />+ <title>Securely Share Secrets{hasCustomBranding ? "" : " | Infisical"}</title><meta property="og:image" content="/images/message.png" /><meta property="og:title" content="" /><meta name="og:description" content="" /></Helmet>- <div className="flex h-screen flex-col justify-between overflow-auto bg-linear-to-tr from-mineshaft-700 to-bunker-800 text-gray-200 dark:scheme-dark">+ <div+ className={twMerge(+ "flex h-screen flex-col justify-between overflow-auto text-gray-200 dark:scheme-dark",+ !backgroundStyle && "bg-linear-to-tr from-mineshaft-700 to-bunker-800"+ )}+ style={backgroundStyle}+ ><div /><div className="mx-auto w-full max-w-xl px-4 py-4 md:px-0"><div className="mb-8 text-center"><div className="mb-4 flex justify-center pt-8">- <a target="_blank" rel="noopener noreferrer" href="https://infisical.com">+ {hasCustomBranding ? (<img- src="/images/gradientLogo.svg"+ src={logoUrl}height={90}width={120}- alt="Infisical logo"- className="cursor-pointer"+ alt="Logo"+ className="max-h-24 w-auto object-contain"/>- </a>+ ) : (+ <a target="_blank" rel="noopener noreferrer" href="https://infisical.com">+ <img+ src={logoUrl}+ height={90}+ width={120}+ alt="Infisical logo"+ className="cursor-pointer"+ />+ </a>+ )}</div>- <h1 className="bg-linear-to-b from-white to-bunker-200 bg-clip-text text-center text-4xl font-medium text-transparent">+ <h1+ className={twMerge(+ "mb-2 bg-linear-to-b bg-clip-text text-center text-4xl font-medium text-transparent",+ brandingTheme && isLightColor(brandingTheme.primaryColor)+ ? "from-black to-bunker-500"+ : "from-white to-bunker-200"+ )}+ >{step === "set-value" ? "Secret Request" : "Secret request shared"}</h1>- <p className="text-sm text-mineshaft-300">- Secret requested by {secretRequest?.requester.username} from the{" "}- {secretRequest?.requester.organizationName} organization- </p>- <p className="text-md mt-2">- Powered by{" "}- <a- href="https://github.com/infisical/infisical"- target="_blank"- rel="noopener noreferrer"- className="text-bold bg-linear-to-tr from-yellow-500 to-primary-500 bg-clip-text text-transparent"+ {secretRequest && (+ <p+ className="text-sm"+ style={brandingTheme ? { color: brandingTheme.textMutedColor } : undefined}>- Infisical →- </a>- </p>+ Secret requested by {secretRequest.request.requester.username} from the{" "}+ {secretRequest.request.requester.organizationName} organization+ </p>+ )}+ {!hasCustomBranding && (+ <p className="text-md mt-2">+ Powered by{" "}+ <a+ href="https://github.com/infisical/infisical"+ target="_blank"+ rel="noopener noreferrer"+ className="text-bold bg-linear-to-tr from-yellow-500 to-primary-500 bg-clip-text text-transparent"+ >+ Infisical →+ </a>+ </p>+ )}</div>{!isPending && (<>{!error &&- secretRequest &&+ !secretRequest?.error &&+ secretRequest?.request &&step === "set-value" &&!secretRequest.isSecretValueSet && (<SecretRequestContaineronSuccess={() => setStep("success")}secretRequestId={id}+ brandingTheme={brandingTheme}/>)}- {secretRequest?.isSecretValueSet && <SecretValueAlreadySharedContainer />}- {error && !isInvalidCredential && !isUnauthorized && <SecretRequestErrorContainer />}+ {secretRequest?.isSecretValueSet && (+ <SecretValueAlreadySharedContainer brandingTheme={brandingTheme} />+ )}+ {secretRequest?.error ||+ (error && !isInvalidCredential && !isUnauthorized && (+ <SecretRequestErrorContainer+ brandingTheme={brandingTheme}+ error={secretRequest?.error}+ />+ ))}{step === "success" && (<SecretRequestSuccessContainer- requesterUsername={secretRequest!.requester.username}+ requesterUsername={secretRequest!.request.requester.username}+ brandingTheme={brandingTheme}/>)}</>)}- <div className="m-auto my-8 flex w-full">- <div className="w-full border-t border-mineshaft-600" />- </div>- <div className="m-auto flex w-full flex-col rounded-md border border-primary-500/30 bg-primary/5 p-6 pt-5">- <p className="w-full pb-2 text-lg font-medium text-mineshaft-100 md:pb-3 md:text-xl">- Open source{" "}- <span className="bg-linear-to-tr from-yellow-500 to-primary-500 bg-clip-text text-transparent">- secret management- </span>{" "}- for developers- </p>- <div className="flex flex-col items-start sm:flex-row sm:items-center">- <p className="md:text-md text-md mr-4">- <a- href="https://github.com/infisical/infisical"- target="_blank"- rel="noopener noreferrer"- className="text-bold bg-linear-to-tr from-yellow-500 to-primary-500 bg-clip-text text-transparent"- >- Infisical- </a>{" "}- is the all-in-one secret management platform to securely manage secrets, configs,- and certificates across your team and infrastructure.- </p>- <div className="mt-4 cursor-pointer sm:mt-0">- <a target="_blank" rel="noopener noreferrer" href="https://infisical.com">- <div className="flex items-center justify-between rounded-md border border-mineshaft-400/40 bg-mineshaft-600 px-3 py-2 duration-200 hover:border-primary/60 hover:bg-primary/20 hover:text-white">- <p className="mr-4 whitespace-nowrap">Try Infisical</p>- <FontAwesomeIcon icon={faArrowRight} />+ {!hasCustomBranding && (+ <>+ <div className="m-auto my-8 flex w-full">+ <div className="w-full border-t border-mineshaft-600" />+ </div>+ <div className="m-auto flex w-full flex-col rounded-md border border-primary-500/30 bg-primary/5 p-6 pt-5">+ <p className="w-full pb-2 text-lg font-medium text-mineshaft-100 md:pb-3 md:text-xl">+ Open source{" "}+ <span className="bg-linear-to-tr from-yellow-500 to-primary-500 bg-clip-text text-transparent">+ secret management+ </span>{" "}+ for developers+ </p>+ <div className="flex flex-col items-start sm:flex-row sm:items-center">+ <p className="md:text-md text-md mr-4">+ <a+ href="https://github.com/infisical/infisical"+ target="_blank"+ rel="noopener noreferrer"+ className="text-bold bg-linear-to-tr from-yellow-500 to-primary-500 bg-clip-text text-transparent"+ >+ Infisical+ </a>{" "}+ is the all-in-one secret management platform to securely manage secrets,+ configs, and certificates across your team and infrastructure.+ </p>+ <div className="mt-4 cursor-pointer sm:mt-0">+ <a target="_blank" rel="noopener noreferrer" href="https://infisical.com">+ <div className="flex items-center justify-between rounded-md border border-mineshaft-400/40 bg-mineshaft-600 px-3 py-2 duration-200 hover:border-primary/60 hover:bg-primary/20 hover:text-white">+ <p className="mr-4 whitespace-nowrap">Try Infisical</p>+ <FontAwesomeIcon icon={faArrowRight} />+ </div>+ </a></div>- </a>+ </div></div>- </div>- </div>- </div>- <div className="w-full bg-mineshaft-600 p-2">- <p className="text-center text-sm text-mineshaft-300">- Made with ❤️ by{" "}- <a className="text-primary" href="https://infisical.com">- Infisical- </a>- <br />- 235 2nd st, San Francisco, California, 94105, United States. 🇺🇸- </p>+ </>+ )}</div>+ {hasCustomBranding ? (+ <div />+ ) : (+ <div className="w-full bg-mineshaft-600 p-2">+ <p className="text-center text-sm text-mineshaft-300">+ Made with ❤️ by{" "}+ <a className="text-primary" href="https://infisical.com">+ Infisical+ </a>+ <br />+ 235 2nd st, San Francisco, California, 94105, United States. 🇺🇸+ </p>+ </div>+ )}</div></>);diff --git a/frontend/src/pages/public/ViewSecretRequestByIDPage/components/SecretErrorContainer.tsx b/frontend/src/pages/public/ViewSecretRequestByIDPage/components/SecretErrorContainer.tsxindex c2e9ce4758..21a5f60b8d 100644--- a/frontend/src/pages/public/ViewSecretRequestByIDPage/components/SecretErrorContainer.tsx+++ b/frontend/src/pages/public/ViewSecretRequestByIDPage/components/SecretErrorContainer.tsx@@ -1,12 +1,36 @@-import { faKey } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";+import { TriangleAlertIcon } from "lucide-react";+import { twMerge } from "tailwind-merge";++import { BrandingTheme } from "../../ViewSharedSecretByIDPage/ViewSharedSecretByIDPage";++type Props = {+ brandingTheme?: BrandingTheme;+ error?: string;+};++export const SecretRequestErrorContainer = ({ error, brandingTheme }: Props) => {+ const panelStyle = brandingTheme+ ? {+ backgroundColor: brandingTheme.panelBg,+ borderColor: brandingTheme.panelBorder,+ color: brandingTheme.textColor+ }+ : undefined;-export const SecretRequestErrorContainer = () => {return (- <div className="rounded-lg border border-mineshaft-600 bg-mineshaft-800 p-8">- <div className="text-center">- <FontAwesomeIcon icon={faKey} size="2x" />- <p className="mt-4">The secret request you are looking for is missing or has expired.</p>+ <div+ className={twMerge(+ "rounded-lg border p-6",+ !brandingTheme && "border-mineshaft-600 bg-mineshaft-800"+ )}+ style={panelStyle}+ >+ <div className="flex items-center gap-4">+ <TriangleAlertIcon+ className="shrink-0"+ style={{ color: brandingTheme?.textMutedColor || "orangered" }}+ />+ <span>{error || "The secret request you are looking for is missing or has expired."}</span></div></div>);diff --git a/frontend/src/pages/public/ViewSecretRequestByIDPage/components/SecretRequestContainer.tsx b/frontend/src/pages/public/ViewSecretRequestByIDPage/components/SecretRequestContainer.tsxindex b4d736aa85..5a95131def 100644--- a/frontend/src/pages/public/ViewSecretRequestByIDPage/components/SecretRequestContainer.tsx+++ b/frontend/src/pages/public/ViewSecretRequestByIDPage/components/SecretRequestContainer.tsx@@ -1,13 +1,14 @@import { Controller, FormProvider, useForm } from "react-hook-form";-import { faArrowRight } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { zodResolver } from "@hookform/resolvers/zod";+import { ArrowRightIcon } from "lucide-react";import { z } from "zod";-import { createNotification } from "@app/components/notifications";-import { Button, FormControl, TextArea } from "@app/components/v2";+import { FormControl, TextArea } from "@app/components/v2";+import { UnstableButton } from "@app/components/v3";import { useSetSecretRequestValue } from "@app/hooks/api";+import { BrandingTheme } from "../../ViewSharedSecretByIDPage/ViewSharedSecretByIDPage";+const formSchema = z.object({secretValue: z.string().min(1)});@@ -15,11 +16,12 @@ const formSchema = z.object({type FormData = z.infer<typeof formSchema>;type Props = {+ brandingTheme?: BrandingTheme;onSuccess: () => void;secretRequestId: string;};-export const SecretRequestContainer = ({ onSuccess, secretRequestId }: Props) => {+export const SecretRequestContainer = ({ brandingTheme, onSuccess, secretRequestId }: Props) => {const form = useForm<FormData>({resolver: zodResolver(formSchema)});@@ -32,47 +34,66 @@ export const SecretRequestContainer = ({ onSuccess, secretRequestId }: Props) =>secretValue: data.secretValue});- createNotification({- title: "Secret request value shared",- text: "The secret request value has been shared",- type: "success"- });-onSuccess();};+ const panelStyle = brandingTheme+ ? {+ backgroundColor: brandingTheme.panelBg,+ borderColor: brandingTheme.panelBorder+ }+ : undefined;++ const inputStyle = brandingTheme+ ? {+ backgroundColor: brandingTheme.inputBg,+ color: brandingTheme.textColor,+ "--muted-color": brandingTheme.textMutedColor,+ borderColor: brandingTheme.panelBorder+ }+ : undefined;+return (<FormProvider {...form}><form onSubmit={form.handleSubmit(onSubmit)}>- <div className="rounded-lg border border-mineshaft-600 bg-mineshaft-800 p-4">- <div className="flex items-center justify-between rounded-md bg-white/5 p-2 text-base text-gray-400">- <div className="w-full">- <Controller- control={form.control}- name="secretValue"- render={({ field, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- isRequired- label="Secret Value"- >- <TextArea {...field} rows={10} reSize="none" />- </FormControl>- )}- />- <Button- isLoading={isPending}- isDisabled={isPending}- colorSchema="secondary"- className="w-full"- type="submit"- >- Share Secret- <FontAwesomeIcon className="ml-2" icon={faArrowRight} />- </Button>- </div>- </div>+ <div+ className={`flex flex-col rounded-lg border p-4 ${brandingTheme ? "" : "border-mineshaft-600 bg-mineshaft-800"}`}+ style={panelStyle}+ >+ <Controller+ control={form.control}+ name="secretValue"+ render={({ field, fieldState: { error } }) => (+ <div style={brandingTheme ? { color: brandingTheme.textColor } : undefined}>+ <FormControl+ isError={Boolean(error)}+ errorText={error?.message}+ isRequired+ label="Secret Value"+ labelClassName="text-[var(--muted-color)]"+ >+ <TextArea+ {...field}+ rows={10}+ reSize="none"+ style={inputStyle}+ className="border placeholder-[var(--muted-color)]/70 focus:ring-[var(--muted-color)]/50"+ />+ </FormControl>+ </div>+ )}+ />+ <UnstableButton+ isPending={isPending}+ isDisabled={isPending}+ variant="neutral"+ className="w-full"+ type="submit"+ style={inputStyle}+ >+ Share Secret+ <ArrowRightIcon />+ </UnstableButton></div></form></FormProvider>diff --git a/frontend/src/pages/public/ViewSecretRequestByIDPage/components/SecretRequestSuccessContainer.tsx b/frontend/src/pages/public/ViewSecretRequestByIDPage/components/SecretRequestSuccessContainer.tsxindex 073e81c444..ecb1e01a48 100644--- a/frontend/src/pages/public/ViewSecretRequestByIDPage/components/SecretRequestSuccessContainer.tsx+++ b/frontend/src/pages/public/ViewSecretRequestByIDPage/components/SecretRequestSuccessContainer.tsx@@ -1,22 +1,45 @@-import { faCheck } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";+import { CircleCheckBigIcon } from "lucide-react";+import { twMerge } from "tailwind-merge";++import { BrandingTheme } from "../../ViewSharedSecretByIDPage/ViewSharedSecretByIDPage";type Props = {+ brandingTheme?: BrandingTheme;requesterUsername: string;};-export const SecretRequestSuccessContainer = ({ requesterUsername }: Props) => {+export const SecretRequestSuccessContainer = ({ brandingTheme, requesterUsername }: Props) => {+ const panelStyle = brandingTheme+ ? {+ backgroundColor: brandingTheme.panelBg,+ color: brandingTheme.textColor,+ "--muted-color": brandingTheme.textMutedColor,+ borderColor: brandingTheme.panelBorder+ }+ : undefined;+return (- <div className="rounded-lg border border-mineshaft-600 bg-mineshaft-800 p-8">- <div className="text-center">- <div className="mx-auto w-min rounded-md border border-mineshaft-800 bg-mineshaft-600 p-3">- <FontAwesomeIcon icon={faCheck} size="2x" className="text-primary-500" />+ <div+ className={twMerge(+ "rounded-lg border p-6",+ !brandingTheme && "border-mineshaft-600 bg-mineshaft-800"+ )}+ style={panelStyle}+ >+ <div className="flex items-center gap-4">+ <CircleCheckBigIcon+ className="size-8 shrink-0"+ style={{ color: brandingTheme?.textMutedColor || "white" }}+ />+ <div className="flex flex-col">+ <span className="font-medium">Secret Shared</span>+ <span+ className={`text-sm ${brandingTheme ? "text-[var(--muted-color)]" : "text-mineshaft-300"}`}+ >+ <strong>{requesterUsername}</strong> has now been notified of your shared secret, and+ will be able to access it shortly.+ </span></div>- <p className="text-md mt-2 font-medium">Secret Shared</p>- <p className="mt-2 text-sm text-mineshaft-300">- <strong>{requesterUsername}</strong> has now been notified of your shared secret, and will- be able to access it shortly.- </p></div></div>);diff --git a/frontend/src/pages/public/ViewSecretRequestByIDPage/components/SecretValueAlreadySharedContainer.tsx b/frontend/src/pages/public/ViewSecretRequestByIDPage/components/SecretValueAlreadySharedContainer.tsxindex 12e57aebe7..e4fb626d73 100644--- a/frontend/src/pages/public/ViewSecretRequestByIDPage/components/SecretValueAlreadySharedContainer.tsx+++ b/frontend/src/pages/public/ViewSecretRequestByIDPage/components/SecretValueAlreadySharedContainer.tsx@@ -1,17 +1,43 @@-import { faKey } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";+import { KeyRoundIcon } from "lucide-react";+import { twMerge } from "tailwind-merge";++import { BrandingTheme } from "../../ViewSharedSecretByIDPage/ViewSharedSecretByIDPage";++type Props = {+ brandingTheme?: BrandingTheme;+};++export const SecretValueAlreadySharedContainer = ({ brandingTheme }: Props) => {+ const panelStyle = brandingTheme+ ? {+ backgroundColor: brandingTheme.panelBg,+ color: brandingTheme.textColor,+ "--muted-color": brandingTheme.textMutedColor,+ borderColor: brandingTheme.panelBorder+ }+ : undefined;-export const SecretValueAlreadySharedContainer = () => {return (- <div className="rounded-lg border border-mineshaft-600 bg-mineshaft-800 p-8">- <div className="text-center">- <div className="mx-auto w-min rounded-md border border-mineshaft-800 bg-mineshaft-600 p-3">- <FontAwesomeIcon icon={faKey} size="2x" className="text-primary-500" />+ <div+ className={twMerge(+ "rounded-lg border p-6",+ !brandingTheme && "border-mineshaft-600 bg-mineshaft-800"+ )}+ style={panelStyle}+ >+ <div className="flex items-center gap-4">+ <KeyRoundIcon+ className="size-8 shrink-0"+ style={{ color: brandingTheme?.textMutedColor || "white" }}+ />+ <div className="flex flex-col">+ <span className="font-medium">Secret Already Shared</span>+ <span+ className={`text-sm ${brandingTheme ? "text-[var(--muted-color)]" : "text-mineshaft-300"}`}+ >+ A secret value has already been shared for this secret request.+ </span></div>- <p className="text-md mt-2 font-medium">Secret Already Shared</p>- <p className="mt-2 text-sm text-mineshaft-300">- A secret value has already been shared for this secret request.- </p></div></div>);diff --git a/frontend/src/pages/public/ViewSharedSecretByIDPage/ViewSharedSecretByIDPage.tsx b/frontend/src/pages/public/ViewSharedSecretByIDPage/ViewSharedSecretByIDPage.tsxindex 3fc635d265..c9fe57d48e 100644--- a/frontend/src/pages/public/ViewSharedSecretByIDPage/ViewSharedSecretByIDPage.tsx+++ b/frontend/src/pages/public/ViewSharedSecretByIDPage/ViewSharedSecretByIDPage.tsx@@ -18,11 +18,11 @@ import {SecretErrorContainer} from "@app/pages/public/ViewSharedSecretByIDPage/components";-const DEFAULT_LOGO_URL = "/images/gradientLogo.svg";-const DEFAULT_FAVICON_URL = "/infisical.ico";+export const DEFAULT_LOGO_URL = "/images/gradientLogo.svg";+export const DEFAULT_FAVICON_URL = "/infisical.ico";// Returns true if the color is considered "light"-const isLightColor = (hexColor: string): boolean => {+export const isLightColor = (hexColor: string): boolean => {const hex = hexColor.replace("#", "");const r = parseInt(hex.substring(0, 2), 16);const g = parseInt(hex.substring(2, 4), 16);@@ -32,7 +32,7 @@ const isLightColor = (hexColor: string): boolean => {};// Adjusts color brightness by a literal amount (negative for darker, positive for lighter)-const adjustColor = (hexColor: string, amount: number): string => {+export const adjustColor = (hexColor: string, amount: number): string => {const hex = hexColor.replace("#", "");const r = Math.max(0, Math.min(255, parseInt(hex.substring(0, 2), 16) + amount));const g = Math.max(0, Math.min(255, parseInt(hex.substring(2, 4), 16) + amount));diff --git a/frontend/src/pages/public/ViewSharedSecretByIDPage/components/SecretErrorContainer.tsx b/frontend/src/pages/public/ViewSharedSecretByIDPage/components/SecretErrorContainer.tsxindex d33a9fe3d1..cffcf129a4 100644--- a/frontend/src/pages/public/ViewSharedSecretByIDPage/components/SecretErrorContainer.tsx+++ b/frontend/src/pages/public/ViewSharedSecretByIDPage/components/SecretErrorContainer.tsx@@ -26,7 +26,10 @@ export const SecretErrorContainer = ({ error, brandingTheme }: Props) => {style={panelStyle}><div className="flex items-center gap-4">- <TriangleAlertIcon style={{ color: brandingTheme?.textMutedColor || "orangered" }} />+ <TriangleAlertIcon+ className="shrink-0"+ style={{ color: brandingTheme?.textMutedColor || "orangered" }}+ /><span>{error || "The secret you are looking for is missing or has expired"}</span></div></div>