Skip to content

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

feat: lint and ui fixes

=ca34885bde94
diff --git a/backend/src/ee/services/license/license-fns.ts b/backend/src/ee/services/license/license-fns.ts
index 66a0bbb0a4..95cf1478a1 100644
--- a/backend/src/ee/services/license/license-fns.ts
+++ b/backend/src/ee/services/license/license-fns.ts
@@ -71,14 +71,14 @@ export const getDefaultOnPremFeatures = (): TFeatureSet => ({
rbac: false,
githubOrgSync: false,
customRateLimits: false,
- subOrganization: false,
+ subOrganization: true,
customAlerts: false,
secretAccessInsights: false,
auditLogs: false,
auditLogsRetentionDays: 0,
auditLogStreams: false,
auditLogStreamLimit: 3,
- samlSSO: false,
+ samlSSO: true,
enforceGoogleSSO: false,
hsm: false,
oidcSSO: false,
@@ -115,7 +115,7 @@ export const getDefaultOnPremFeatures = (): TFeatureSet => ({
machineIdentityAuthTemplates: false,
pkiLegacyTemplates: false,
secretShareExternalBranding: false,
- emailDomainVerification: false
+ emailDomainVerification: true
});
export const setupLicenseRequestWithStore = (
diff --git a/backend/src/ee/services/saml-config/saml-config-service.ts b/backend/src/ee/services/saml-config/saml-config-service.ts
index 4b4bc05619..0d1f458973 100644
--- a/backend/src/ee/services/saml-config/saml-config-service.ts
+++ b/backend/src/ee/services/saml-config/saml-config-service.ts
@@ -16,7 +16,6 @@ import {
} from "@app/db/schemas";
import { throwOnPlanSeatLimitReached } from "@app/ee/services/license/license-fns";
import { BadRequestError, ForbiddenRequestError, NotFoundError } from "@app/lib/errors";
-import { logger } from "@app/lib/logger";
import { validateEmail } from "@app/lib/validator/validate-email";
import { TAuthLoginFactory } from "@app/services/auth/auth-login-service";
import { AuthMethod } from "@app/services/auth/auth-type";
diff --git a/backend/src/server/routes/v1/sso-router.ts b/backend/src/server/routes/v1/sso-router.ts
index 9b64e72647..d66f782efc 100644
--- a/backend/src/server/routes/v1/sso-router.ts
+++ b/backend/src/server/routes/v1/sso-router.ts
@@ -399,9 +399,7 @@ export const registerSsoRouter = async (server: FastifyZodProvider) => {
]
.filter(Boolean)
.join("&");
- return res.redirect(
- `${appCfg.SITE_URL}/login/select-organization${sessionParams ? `?${sessionParams}` : ""}`
- );
+ return res.redirect(`${appCfg.SITE_URL}/login/select-organization${sessionParams ? `?${sessionParams}` : ""}`);
}
if (passportResult.result === ProviderAuthResult.SIGNUP_REQUIRED) {
diff --git a/backend/src/server/routes/v2/user-router.ts b/backend/src/server/routes/v2/user-router.ts
index 5ca8d9578b..a57bb3f013 100644
--- a/backend/src/server/routes/v2/user-router.ts
+++ b/backend/src/server/routes/v2/user-router.ts
@@ -31,30 +31,6 @@ export const registerUserRouter = async (server: FastifyZodProvider) => {
}
});
- server.route({
- method: "POST",
- url: "/me/emails/verify",
- config: {
- rateLimit: smtpRateLimit({
- keyGenerator: (req) => (req.body as { username?: string })?.username?.trim().substring(0, 100) || req.realIp
- })
- },
- schema: {
- operationId: "verifyEmailVerificationCode",
- body: z.object({
- username: z.string().trim(),
- code: z.string().trim()
- }),
- response: {
- 200: z.object({})
- }
- },
- handler: async (req) => {
- await server.services.user.verifyEmailVerificationCode(req.body.username, req.body.code);
- return {};
- }
- });
-
server.route({
method: "PATCH",
url: "/me/mfa",
diff --git a/backend/src/services/user/user-service.ts b/backend/src/services/user/user-service.ts
index 8750412ddb..438451b756 100644
--- a/backend/src/services/user/user-service.ts
+++ b/backend/src/services/user/user-service.ts
@@ -97,35 +97,6 @@ export const userServiceFactory = ({
});
};
- const verifyEmailVerificationCode = async (username: string, code: string) => {
- // akhilmhdh: case sensitive email resolution
- const user = await userDAL.findOne({ username });
- if (!user) throw new NotFoundError({ name: `User with username '${username}' not found` });
- if (!user.email)
- throw new BadRequestError({ name: "Failed to verify email verification code due to no email on user" });
-
- const token = await tokenService.validateTokenForUser({
- type: TokenType.TOKEN_EMAIL_VERIFICATION,
- userId: user.id,
- code
- });
-
- if (token?.aliasId) {
- const userAlias = await userAliasDAL.findOne({ userId: user.id, id: token.aliasId });
- if (!userAlias) throw new NotFoundError({ name: `User alias with ID '${token.aliasId}' not found` });
- if (userAlias?.isEmailVerified)
- throw new BadRequestError({ name: "Failed to verify email verification code due to email already verified" });
-
- await userAliasDAL.updateById(token.aliasId, { isEmailVerified: true });
- }
- const userEmails = user?.email ? await userDAL.find({ email: user.email }) : [];
-
- await userDAL.updateById(user.id, {
- isEmailVerified: true,
- username: userEmails?.length === 1 && userEmails?.[0]?.id === user.id ? user.email.toLowerCase() : undefined
- });
- };
-
const updateUserMfa = async ({ userId, isMfaEnabled, selectedMfaMethod }: TUpdateUserMfaDTO) => {
const user = await userDAL.findById(userId);
@@ -456,6 +427,7 @@ export const userServiceFactory = ({
const listUserGroups = async ({ username, actorOrgId, actor, actorId, actorAuthMethod }: TListUserGroupsDTO) => {
// akhilmhdh: case sensitive email resolution
const user = await userDAL.findOne({ username });
+
if (!user) throw new NotFoundError({ name: `User with username '${username}' not found` });
// This makes it so the user can always read information about themselves, but no one else if they don't have the Members Read permission.
@@ -477,7 +449,6 @@ export const userServiceFactory = ({
return {
sendEmailVerificationCode,
- verifyEmailVerificationCode,
updateUserMfa,
updateUserName,
updateAuthMethods,
diff --git a/frontend/src/hooks/api/users/index.tsx b/frontend/src/hooks/api/users/index.tsx
index 36bccdb8aa..1645dc8ce5 100644
--- a/frontend/src/hooks/api/users/index.tsx
+++ b/frontend/src/hooks/api/users/index.tsx
@@ -4,8 +4,7 @@ export {
useRequestEmailChangeOTP,
useRevokeMySessionById,
useSendEmailVerificationCode,
- useUpdateUserEmail,
- useVerifyEmailVerificationCode
+ useUpdateUserEmail
} from "./mutation";
export {
fetchOrgUsers,
diff --git a/frontend/src/hooks/api/users/mutation.tsx b/frontend/src/hooks/api/users/mutation.tsx
index 10df1b8a97..621a2fc7e4 100644
--- a/frontend/src/hooks/api/users/mutation.tsx
+++ b/frontend/src/hooks/api/users/mutation.tsx
@@ -41,18 +41,6 @@ export const useSendEmailVerificationCode = () => {
});
};
-export const useVerifyEmailVerificationCode = () => {
- return useMutation({
- mutationFn: async ({ username, code }: { username: string; code: string }) => {
- await apiRequest.post("/api/v2/users/me/emails/verify", {
- username,
- code
- });
- return {};
- }
- });
-};
-
export const useUpdateUserProjectFavorites = () => {
const queryClient = useQueryClient();
return useMutation({
diff --git a/frontend/src/pages/auth/LoginPage/Login.utils.tsx b/frontend/src/pages/auth/LoginPage/Login.utils.tsx
index 489a4afe7a..5698ed0f7c 100644
--- a/frontend/src/pages/auth/LoginPage/Login.utils.tsx
+++ b/frontend/src/pages/auth/LoginPage/Login.utils.tsx
@@ -22,10 +22,6 @@ export const navigateUserToOrg = async ({
organizationId,
navigateTo
}: NavigateUserToOrgParams) => {
- const userOrgs = await fetchOrganizations();
-
- const nonAuthEnforcedOrgs = userOrgs.filter((org) => !org.authEnforced);
-
if (organizationId) {
localStorage.setItem("orgData.id", organizationId);
navigate({
@@ -35,6 +31,8 @@ export const navigateUserToOrg = async ({
return;
}
+ const userOrgs = await fetchOrganizations();
+ const nonAuthEnforcedOrgs = userOrgs.filter((org) => !org.authEnforced);
if (nonAuthEnforcedOrgs.length > 0) {
// user is part of at least 1 non-auth enforced org
const userOrg = nonAuthEnforcedOrgs[0] && nonAuthEnforcedOrgs[0].id;
diff --git a/frontend/src/pages/auth/LoginPage/components/InitialStep/InitialStep.tsx b/frontend/src/pages/auth/LoginPage/components/InitialStep/InitialStep.tsx
index 7803062c19..3d7c77ef6e 100644
--- a/frontend/src/pages/auth/LoginPage/components/InitialStep/InitialStep.tsx
+++ b/frontend/src/pages/auth/LoginPage/components/InitialStep/InitialStep.tsx
@@ -128,11 +128,8 @@ export const InitialStep = ({ setSection, isAdmin }: Props) => {
searchParams.append("is_admin_login", "true");
}
const qs = searchParams.toString();
- const popup = window.open(`/api/v1/sso/redirect/${method}${qs ? `?${qs}` : ""}`);
- if (popup) {
- saveLastLogin({ method });
- }
- window.close();
+ saveLastLogin({ method });
+ window.location.replace(`/api/v1/sso/redirect/${method}${qs ? `?${qs}` : ""}`);
};
const isLastUsedMethod = (method: LoginMethod) => lastLogin?.method === method;
diff --git a/frontend/src/pages/auth/SignUpSsoPage/SignUpSsoPage.tsx b/frontend/src/pages/auth/SignUpSsoPage/SignUpSsoPage.tsx
index a748de67c7..6a42e1e914 100644
--- a/frontend/src/pages/auth/SignUpSsoPage/SignUpSsoPage.tsx
+++ b/frontend/src/pages/auth/SignUpSsoPage/SignUpSsoPage.tsx
@@ -7,54 +7,57 @@ import { jwtDecode } from "jwt-decode";
import { AuthPageBackground } from "@app/components/auth/AuthPageBackground";
import { AuthPageFooter } from "@app/components/auth/AuthPageFooter";
-import Error from "@app/components/basic/Error";
+import { AuthPageHeader } from "@app/components/auth/AuthPageHeader";
import { createNotification } from "@app/components/notifications";
import SecurityClient from "@app/components/utilities/SecurityClient";
-import { Button, Input } from "@app/components/v2";
+import {
+ Button,
+ FieldError,
+ UnstableCard,
+ UnstableCardContent,
+ UnstableCardHeader,
+ UnstableCardTitle,
+ UnstableInput
+} from "@app/components/v3";
import { ROUTE_PATHS } from "@app/const/routes";
import { useSendEmailVerificationCode } from "@app/hooks/api";
import { useCompleteAccountSignup } from "@app/hooks/api/auth/queries";
-enum SignupSsoStep {
- VerifyCode = "verify-code",
- OrgName = "org-name"
-}
-
-const codeInputProps = {
+const codeInputStyle = {
inputStyle: {
fontFamily: "monospace",
margin: "4px",
MozAppearance: "textfield",
width: "55px",
- borderRadius: "5px",
+ borderRadius: "6px",
fontSize: "24px",
height: "55px",
paddingLeft: "7",
- backgroundColor: "#0d1117",
- color: "white",
- border: "1px solid #2d2f33",
+ backgroundColor: "transparent",
+ color: "#ebebeb",
+ border: "1px solid #2b2c30",
textAlign: "center",
- outlineColor: "#8ca542",
- borderColor: "#2d2f33"
+ outlineColor: "#2d2f33",
+ borderColor: "#2b2c30"
}
} as const;
-const codeInputPropsPhone = {
+const codeInputStylePhone = {
inputStyle: {
fontFamily: "monospace",
margin: "4px",
MozAppearance: "textfield",
width: "40px",
- borderRadius: "5px",
+ borderRadius: "6px",
fontSize: "24px",
height: "40px",
paddingLeft: "7",
- backgroundColor: "#0d1117",
- color: "white",
- border: "1px solid #2d2f33",
+ backgroundColor: "transparent",
+ color: "#ebebeb",
+ border: "1px solid #2b2c30",
textAlign: "center",
- outlineColor: "#8ca542",
- borderColor: "#2d2f33"
+ outlineColor: "#2d2f33",
+ borderColor: "#2b2c30"
}
} as const;
@@ -64,7 +67,6 @@ export const SignupSsoPage = () => {
const search = useSearch({ from: ROUTE_PATHS.Auth.SignUpSsoPage.id });
const token = search.token as string;
- const [step, setStep] = useState(SignupSsoStep.VerifyCode);
const [code, setCode] = useState("");
const [organizationName, setOrganizationName] = useState("");
const [orgNameError, setOrgNameError] = useState(false);
@@ -81,7 +83,6 @@ export const SignupSsoPage = () => {
organizationId?: string;
};
- // If token has an organizationId, the user already belongs to an org (IdP or invited)
const needsOrgName = !decoded.organizationId;
const { mutateAsync: sendEmailVerificationCode } = useSendEmailVerificationCode();
@@ -91,6 +92,12 @@ export const SignupSsoPage = () => {
}, [token]);
const handleSubmit = async () => {
+ if (needsOrgName && !organizationName.trim()) {
+ setOrgNameError(true);
+ return;
+ }
+ setOrgNameError(false);
+
const { token: accessToken } = await completeAccountSignup.mutateAsync({
type: "alias",
code,
@@ -115,25 +122,6 @@ export const SignupSsoPage = () => {
}
};
- const handleCodeNext = async () => {
- if (needsOrgName) {
- // Move to org name step — code will be submitted together with org name
- setStep(SignupSsoStep.OrgName);
- } else {
- // No org needed, submit directly
- await handleSubmit();
- }
- };
-
- const handleOrgNameSubmit = async () => {
- if (!organizationName.trim()) {
- setOrgNameError(true);
- return;
- }
- setOrgNameError(false);
- await handleSubmit();
- };
-
const handleResendCode = async () => {
try {
await sendEmailVerificationCode(token);
@@ -150,7 +138,7 @@ export const SignupSsoPage = () => {
};
return (
- <div className="relative flex max-h-screen min-h-screen flex-col overflow-y-auto bg-linear-to-tr from-card via-bunker-900 to-card px-6">
+ <div className="relative flex max-h-screen min-h-screen flex-col overflow-y-auto bg-linear-to-tr from-card via-bunker-900 to-card px-4">
<AuthPageBackground />
<Helmet>
<title>{t("common.head-title", { title: t("signup.title") })}</title>
@@ -159,131 +147,96 @@ export const SignupSsoPage = () => {
<meta property="og:title" content={t("signup.og-title") as string} />
<meta name="og:description" content={t("signup.og-description") as string} />
</Helmet>
+ <AuthPageHeader>
+ <Button asChild>
+ <Link to="/login">Log In</Link>
+ </Button>
+ </AuthPageHeader>
<div className="relative z-10 my-auto flex flex-col items-center py-10">
- <Link to="/">
- <div className="mb-4 flex justify-center">
- <img
- src="/images/gradientLogo.svg"
- style={{ height: "90px", width: "120px" }}
- alt="Infisical logo"
- />
- </div>
- </Link>
- <div className="mx-auto h-full w-full pb-4 md:px-8">
- {step === SignupSsoStep.VerifyCode && (
- <>
- <p className="text-md flex justify-center text-bunker-200">
- We&apos;ve sent a verification code to {decoded.email}
- </p>
- <div className="mx-auto hidden w-max min-w-[20rem] md:block">
- <ReactCodeInput
- name=""
- inputMode="tel"
- type="text"
- fields={6}
- onChange={setCode}
- {...codeInputProps}
- className="mt-6 mb-2"
- />
- </div>
- <div className="mx-auto mt-4 block w-max md:hidden">
- <ReactCodeInput
- name=""
- inputMode="tel"
- type="text"
- fields={6}
- onChange={setCode}
- {...codeInputPropsPhone}
- className="mt-2 mb-2"
- />
- </div>
- {completeAccountSignup.isError && (
- <Error text="Oops. Your code is wrong. Please try again." />
- )}
- <div className="mx-auto mt-2 flex w-1/4 max-w-xs min-w-[20rem] flex-col items-center justify-center text-center text-sm md:max-w-md md:text-left lg:w-[19%]">
- <div className="text-l w-full py-1 text-lg">
+ <form className="w-full" onSubmit={(e) => e.preventDefault()}>
+ <div className="mx-auto flex w-full flex-col items-center justify-center">
+ <UnstableCard className="mx-auto w-full max-w-md items-stretch gap-0 p-6">
+ <UnstableCardHeader className="mb-2 gap-2">
+ <UnstableCardTitle className="bg-linear-to-b from-white to-bunker-200 bg-clip-text text-center text-[1.55rem] font-medium text-transparent">
+ We&apos;ve sent a verification code to
+ </UnstableCardTitle>
+ </UnstableCardHeader>
+ <UnstableCardContent>
+ <p className="text-md my-1 flex justify-center font-medium text-foreground">
+ {decoded.email}
+ </p>
+ <div className="mx-auto hidden w-max min-w-[20rem] md:block">
+ <ReactCodeInput
+ name=""
+ inputMode="tel"
+ type="text"
+ fields={6}
+ onChange={setCode}
+ {...codeInputStyle}
+ className="code-input-v3 mt-6 mb-2"
+ />
+ </div>
+ <div className="mx-auto mt-4 block w-max md:hidden">
+ <ReactCodeInput
+ name=""
+ inputMode="tel"
+ type="text"
+ fields={6}
+ onChange={setCode}
+ {...codeInputStylePhone}
+ className="code-input-v3 mt-2 mb-2"
+ />
+ </div>
+ {needsOrgName && (
+ <div className="mt-4 w-full">
+ <p className="mb-1 ml-1 text-sm font-medium text-label">Organization Name</p>
+ <UnstableInput
+ value={organizationName}
+ onChange={(e) => {
+ setOrganizationName(e.target.value);
+ if (e.target.value.trim()) setOrgNameError(false);
+ }}
+ placeholder="acme"
+ maxLength={64}
+ className="h-10"
+ />
+ {orgNameError && <FieldError>Please enter an organization name.</FieldError>}
+ </div>
+ )}
+ {completeAccountSignup.isError && (
+ <FieldError>Oops. Your code is wrong. Please try again.</FieldError>
+ )}
+ <div className="mt-4 w-full">
<Button
type="submit"
- onClick={handleCodeNext}
- size="sm"
+ onClick={handleSubmit}
+ variant="project"
+ size="lg"
isFullWidth
- className="h-14"
- colorSchema="primary"
- variant="outline_bg"
- isLoading={completeAccountSignup.isPending}
+ isPending={completeAccountSignup.isPending}
+ isDisabled={completeAccountSignup.isPending}
>
- {needsOrgName ? "Next" : "Verify"}
+ Verify
</Button>
</div>
- </div>
- <div className="mx-auto flex max-h-24 w-full max-w-md flex-col items-center justify-center pt-2">
- <div className="flex flex-row items-baseline gap-1 text-sm">
- <span className="text-bunker-400">Don&apos;t see the code?</span>
- <div className="text-md mt-2 flex flex-row text-bunker-400">
+ <div className="mt-6 flex flex-col items-center gap-2 text-xs text-label">
+ <div className="flex flex-row items-baseline gap-1">
<button
disabled={completeAccountSignup.isPending}
onClick={handleResendCode}
type="button"
>
- <span className="cursor-pointer duration-200 hover:text-bunker-200 hover:underline hover:decoration-primary-700 hover:underline-offset-4">
- Resend
+ <span className="cursor-pointer duration-200 hover:text-foreground hover:underline hover:decoration-project/45 hover:underline-offset-2">
+ Don&apos;t see the code? Resend
</span>
</button>
</div>
+ <p className="text-label">Make sure to check your spam inbox.</p>
</div>
- <p className="pb-2 text-sm text-bunker-400">Make sure to check your spam inbox.</p>
- </div>
- </>
- )}
- {step === SignupSsoStep.OrgName && (
- <div className="mx-auto flex w-full max-w-xs flex-col items-center">
- <p className="text-md mb-6 text-bunker-200">Create your organization</p>
- <div className="w-full">
- <p className="mb-1 ml-1 text-sm font-medium text-bunker-300">Organization Name</p>
- <Input
- value={organizationName}
- onChange={(e) => {
- setOrganizationName(e.target.value);
- if (e.target.value.trim()) setOrgNameError(false);
- }}
- placeholder="Infisical"
- maxLength={64}
- isError={orgNameError}
- />
- {orgNameError && (
- <p className="mt-1 text-xs text-red-500">Please enter an organization name.</p>
- )}
- </div>
- {completeAccountSignup.isError && (
- <Error text="Something went wrong. Please try again." />
- )}
- <div className="mt-6 flex w-full gap-2">
- <Button
- onClick={() => setStep(SignupSsoStep.VerifyCode)}
- size="sm"
- className="h-14"
- colorSchema="secondary"
- variant="outline_bg"
- isDisabled={completeAccountSignup.isPending}
- >
- Back
- </Button>
- <Button
- type="submit"
- onClick={handleOrgNameSubmit}
- size="sm"
- isFullWidth
- className="h-14"
- colorSchema="primary"
- variant="outline_bg"
- isLoading={completeAccountSignup.isPending}
- >
- Complete
- </Button>
- </div>
- </div>
- )}
- </div>
+ </UnstableCardContent>
+ </UnstableCard>
+ </div>
+ </form>
</div>
<AuthPageFooter />
</div>