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
feat(settings): revamp personal settings (#7469)
Andrew Huangab88725c7aff
diff --git a/frontend/CLAUDE.md b/frontend/CLAUDE.mdindex be22656b67..f49f6495fe 100644--- a/frontend/CLAUDE.md+++ b/frontend/CLAUDE.md@@ -55,6 +55,8 @@ The `QueryClient` sets these global defaults for all queries:- **`refetchOnWindowFocus: false`** — queries do not refetch when the browser tab regains focus.- **`retry: 1`** — failed queries retry once.+Mutation failures are reported globally by `MutationCache.onError` using the server error message. Do not add another error `createNotification` in a mutation `catch` or `onError`, because it produces duplicate toasts. Local error handling may still restore optimistic state, keep a dialog open, or perform other control flow without displaying a second notification.+When adding new queries, consider whether the default 60s staleTime is appropriate:- For data that changes only on explicit user action (secrets, folders, org metadata): the 60s default is fine or could be longer.- For data that must always be fresh (auth configs, lease TTLs): override with `staleTime: 0, gcTime: 0`.diff --git a/frontend/src/components/auth/PasswordField.tsx b/frontend/src/components/auth/PasswordField.tsxindex 6489535c18..0f86847102 100644--- a/frontend/src/components/auth/PasswordField.tsx+++ b/frontend/src/components/auth/PasswordField.tsx@@ -24,6 +24,7 @@ type PasswordFieldProps = {policy: TPasswordPolicy;breachStatus: PasswordBreachCheckStatus;registration: UseFormRegisterReturn;+ label?: string;placeholder?: string;error?: ReactHookFormFieldError;submitCount: number;@@ -36,6 +37,7 @@ export const PasswordField = ({policy,breachStatus,registration,+ label = "Password",placeholder,error,submitCount,@@ -51,7 +53,7 @@ export const PasswordField = ({return (<Field data-invalid={Boolean(error)}>- <FieldLabel htmlFor={id}>Password</FieldLabel>+ <FieldLabel htmlFor={id}>{label}</FieldLabel><InputGroup variant={variant}><InputGroupInput{...registration}diff --git a/frontend/src/components/features/WishForm.tsx b/frontend/src/components/features/WishForm.tsxindex 28107809aa..7e2410e064 100644--- a/frontend/src/components/features/WishForm.tsx+++ b/frontend/src/components/features/WishForm.tsx@@ -1,23 +1,24 @@import { useForm } from "react-hook-form";-import { faRocketchat } from "@fortawesome/free-brands-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { zodResolver } from "@hookform/resolvers/zod";+import { MessageCircleIcon } from "lucide-react";import { z } from "zod";import { createNotification } from "@app/components/notifications";import {Button,- FormControl,+ Field,+ FieldError,+ FieldLabel,Popover,PopoverContent,PopoverTrigger,TextArea-} from "@app/components/v2";+} from "@app/components/v3";import { useToggle } from "@app/hooks";import { useCreateUserWish } from "@app/hooks/api/userEngagement";const formSchema = z.object({- text: z.string().trim().min(1)+ text: z.string().trim().min(1, "Enter a feature request.")});type TFormData = z.infer<typeof formSchema>;@@ -40,58 +41,38 @@ export const WishForm = () => {});createNotification({- text: "Your wish has been sent to the Infisical team!",+ text: "Feature request sent.",type: "success"});+ reset();setIsOpen.off();};return (- <Popover- onOpenChange={() => {- setIsOpen.toggle();- reset();- }}- open={isOpen}- >+ <Popover onOpenChange={(open) => (open ? setIsOpen.on() : setIsOpen.off())} open={isOpen}><PopoverTrigger asChild>- <div className="mb-3 w-full cursor-pointer pl-5 text-sm whitespace-nowrap text-mineshaft-400 duration-200 hover:text-mineshaft-200">- <FontAwesomeIcon icon={faRocketchat} className="mr-2" />+ <Button variant="outline" size="sm">+ <MessageCircleIcon />Request a feature- </div>+ </Button></PopoverTrigger>- <PopoverContent- hideCloseBtn- align="end"- alignOffset={20}- className="mb-1 w-auto border border-mineshaft-600 bg-mineshaft-900 p-4 drop-shadow-2xl"- sticky="always"- >+ <PopoverContent align="end" className="w-72 sm:w-96"><form onSubmit={handleSubmit(createWish)}>- <FormControl- className="mb-0"- isError={Boolean(errors?.text)}- errorText={errors?.text?.message}- >+ <Field data-invalid={Boolean(errors.text)}>+ <FieldLabel htmlFor="feature-request">Feature request</FieldLabel><TextArea- className="border border-mineshaft-600 bg-black/10 text-sm focus:ring-0"- variant="outline"- placeholder="Wish for anything! Help us improve the platform."- reSize="none"+ id="feature-request"+ placeholder="Describe what would improve your workflow."+ className="resize-none"rows={6}- cols={40}+ aria-invalid={Boolean(errors.text)}{...register("text")}/>- </FormControl>+ <FieldError errors={[errors.text]} />+ </Field><div className="flex justify-end pt-2">- <Button- className="w-min"- colorSchema="secondary"- type="submit"- isLoading={isSubmitting}- disabled={isSubmitting}- >+ <Button variant="neutral" type="submit" isPending={isSubmitting}>Send</Button></div>diff --git a/frontend/src/components/mfa/setup/RecoveryCodesView.tsx b/frontend/src/components/mfa/setup/RecoveryCodesView.tsxindex a84ac31ece..6b5453c35a 100644--- a/frontend/src/components/mfa/setup/RecoveryCodesView.tsx+++ b/frontend/src/components/mfa/setup/RecoveryCodesView.tsx@@ -53,7 +53,7 @@ export const RecoveryCodesView = ({ recoveryCodes, onSaved, acknowledgment }: Prreturn (<div className="flex flex-col gap-3"><div className="rounded-lg border border-border bg-container p-4">- <div className="grid grid-cols-2 gap-x-6 gap-y-2 font-mono text-sm">+ <div className="grid grid-cols-1 gap-x-6 gap-y-2 font-mono text-sm sm:grid-cols-2">{recoveryCodes.map((code, index) => (<div key={code} className="flex items-center text-foreground"><span className="w-6 text-right text-muted">{index + 1}.</span>@@ -62,8 +62,8 @@ export const RecoveryCodesView = ({ recoveryCodes, onSaved, acknowledgment }: Pr))}</div></div>- <div className="grid grid-cols-2 gap-3">- <Button variant="org" isFullWidth onClick={handleDownload}>+ <div className="grid grid-cols-1 gap-3 sm:grid-cols-2">+ <Button variant="neutral" isFullWidth onClick={handleDownload}><DownloadIcon /> Download</Button><Button variant="outline" isFullWidth onClick={handleCopy}>@@ -75,7 +75,7 @@ export const RecoveryCodesView = ({ recoveryCodes, onSaved, acknowledgment }: Pr<div className="flex items-center gap-2"><Checkboxid="acknowledge-recovery-codes"- variant="org"+ variant="neutral"isChecked={acknowledgment.isAcknowledged}onCheckedChange={(checked) => acknowledgment.onAcknowledgedChange(checked === true)}/>@@ -89,7 +89,7 @@ export const RecoveryCodesView = ({ recoveryCodes, onSaved, acknowledgment }: Pr</FieldLabel></div><Button- variant="org"+ variant="neutral"isFullWidthisDisabled={!acknowledgment.isAcknowledged}isPending={acknowledgment.isConfirmPending}diff --git a/frontend/src/components/mfa/setup/VerifyStep.tsx b/frontend/src/components/mfa/setup/VerifyStep.tsxindex 4e2d7ad684..85d5b8775f 100644--- a/frontend/src/components/mfa/setup/VerifyStep.tsx+++ b/frontend/src/components/mfa/setup/VerifyStep.tsx@@ -3,8 +3,15 @@ import { FingerprintIcon } from "lucide-react";import QRCode from "qrcode";import { createNotification } from "@app/components/notifications";-import { ContentLoader } from "@app/components/v2";-import { Button, Input, VerificationCodeForm } from "@app/components/v3";+import {+ Button,+ Field,+ FieldDescription,+ FieldLabel,+ Input,+ Skeleton,+ VerificationCodeForm+} from "@app/components/v3";import { MfaMethod } from "@app/hooks/api/auth/types";import { useEnrollMfa, useGetUserTotpRegistration } from "@app/hooks/api/users";import { useRegisterPasskey } from "@app/hooks/api/webauthn";@@ -12,9 +19,16 @@ import { useRegisterPasskey } from "@app/hooks/api/webauthn";type Props = {method: MfaMethod;onVerified: () => void | Promise<void>;+ variant?: React.ComponentProps<typeof Button>["variant"];};-const TotpVerify = ({ onVerified }: { onVerified: Props["onVerified"] }) => {+const TotpVerify = ({+ onVerified,+ variant+}: {+ onVerified: Props["onVerified"];+ variant: Props["variant"];+}) => {const [hasRegistered, setHasRegistered] = useState(false);const { data: registration, isPending } = useGetUserTotpRegistration({ enabled: !hasRegistered });const { mutateAsync: enrollMfa, isPending: isVerifying } = useEnrollMfa();@@ -44,7 +58,14 @@ const TotpVerify = ({ onVerified }: { onVerified: Props["onVerified"] }) => {}};- if (isPending) return <ContentLoader />;+ if (isPending) {+ return (+ <div className="space-y-4" aria-label="Loading authenticator setup">+ <Skeleton className="mx-auto h-44 w-44" />+ <Skeleton className="h-9 w-full" />+ </div>+ );+ }return (<div className="flex flex-col gap-4">@@ -74,6 +95,7 @@ const TotpVerify = ({ onVerified }: { onVerified: Props["onVerified"] }) => {setVerificationError(undefined);}}onSubmit={handleVerify}+ submitVariant={variant}isPending={isVerifying}error={verificationError}/>@@ -81,7 +103,13 @@ const TotpVerify = ({ onVerified }: { onVerified: Props["onVerified"] }) => {);};-const WebAuthnVerify = ({ onVerified }: { onVerified: Props["onVerified"] }) => {+const WebAuthnVerify = ({+ onVerified,+ variant+}: {+ onVerified: Props["onVerified"];+ variant: Props["variant"];+}) => {const { registerPasskey, isRegistering } = useRegisterPasskey();const { mutateAsync: enrollMfa } = useEnrollMfa();const [name, setName] = useState("");@@ -105,20 +133,25 @@ const WebAuthnVerify = ({ onVerified }: { onVerified: Props["onVerified"] }) =>Register a passkey using Face ID, Touch ID, a security key, or your device. Optionally giveit a name so you can recognize it later.</p>- <Input- variant="outlined"- value={name}- onChange={(e) => setName(e.target.value)}- placeholder="Passkey name (optional)"- />- <Button variant="org" isPending={isRegistering} onClick={handleRegister}>- <FingerprintIcon /> Register Passkey+ <Field>+ <FieldLabel htmlFor="mfa-passkey-name">Passkey name</FieldLabel>+ <Input+ id="mfa-passkey-name"+ variant="outlined"+ value={name}+ onChange={(e) => setName(e.target.value)}+ placeholder="Optional"+ />+ <FieldDescription>Use a name that helps you recognize this device.</FieldDescription>+ </Field>+ <Button variant={variant} isPending={isRegistering} onClick={handleRegister}>+ <FingerprintIcon /> Register passkey</Button></div>);};-export const VerifyStep = ({ method, onVerified }: Props) => {- if (method === MfaMethod.TOTP) return <TotpVerify onVerified={onVerified} />;- return <WebAuthnVerify onVerified={onVerified} />;+export const VerifyStep = ({ method, onVerified, variant = "project" }: Props) => {+ if (method === MfaMethod.TOTP) return <TotpVerify onVerified={onVerified} variant={variant} />;+ return <WebAuthnVerify onVerified={onVerified} variant={variant} />;};diff --git a/frontend/src/components/v3/generic/Card/Card.tsx b/frontend/src/components/v3/generic/Card/Card.tsxindex 729263ff2f..8b146c4eab 100644--- a/frontend/src/components/v3/generic/Card/Card.tsx+++ b/frontend/src/components/v3/generic/Card/Card.tsx@@ -22,7 +22,7 @@ function CardHeader({ className, ...props }: React.ComponentProps<"div">) {<divdata-slot="card-header"className={cn(- "@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-center gap-1",+ "@container/card-header grid auto-rows-min items-center gap-2","border-border [.border-b]:pb-4","has-data-[slot=card-action]:@xs:grid-cols-[1fr_auto]","has-data-[slot=icon-button]:grid-cols-[1fr_auto]",@@ -75,7 +75,7 @@ function CardFooter({ className, ...props }: React.ComponentProps<"div">) {return (<divdata-slot="card-footer"- className={cn("flex items-center border-border [.border-t]:pt-6", className)}+ className={cn("flex items-center border-border", className)}{...props}/>);diff --git a/frontend/src/components/v3/generic/Switch/Switch.tsx b/frontend/src/components/v3/generic/Switch/Switch.tsxindex 5e6cea445a..9eacad2720 100644--- a/frontend/src/components/v3/generic/Switch/Switch.tsx+++ b/frontend/src/components/v3/generic/Switch/Switch.tsx@@ -12,8 +12,8 @@ const switchVariants = cva("outline-none after:absolute after:-inset-x-3 after:-inset-y-2","focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",- "data-[size=default]:h-[18.4px] data-[size=default]:w-[32px]",- "data-[size=sm]:h-[14px] data-[size=sm]:w-[24px]",+ "data-[size=default]:h-5 data-[size=default]:w-9",+ "data-[size=sm]:h-4 data-[size=sm]:w-7","border-border bg-transparent hover:border-foreground/25","aria-invalid:border-destructive aria-invalid:ring-[3px] aria-invalid:ring-destructive/20","dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40"@@ -22,22 +22,22 @@ const switchVariants = cva(variants: {variant: {outline:- "data-[state=checked]:border-border data-[state=checked]:bg-foreground/10 data-[state=checked]:hover:bg-foreground/15 data-[state=checked]:hover:border-foreground/30",+ "data-[state=checked]:border-foreground/10 data-[state=checked]:bg-foreground/25 data-[state=checked]:hover:border-foreground/15 data-[state=checked]:hover:bg-foreground/30",neutral:- "data-[state=checked]:border-neutral/25 data-[state=checked]:bg-neutral/10 data-[state=checked]:hover:bg-neutral/15 data-[state=checked]:hover:border-neutral/30",+ "data-[state=checked]:border-neutral/10 data-[state=checked]:bg-neutral/25 data-[state=checked]:hover:border-neutral/15 data-[state=checked]:hover:bg-neutral/30",project:- "data-[state=checked]:border-project/25 data-[state=checked]:bg-project/10 data-[state=checked]:hover:bg-project/15 data-[state=checked]:hover:border-project/30",- org: "data-[state=checked]:border-org/25 data-[state=checked]:bg-org/10 data-[state=checked]:hover:bg-org/15 data-[state=checked]:hover:border-org/30",+ "data-[state=checked]:border-project/10 data-[state=checked]:bg-project/25 data-[state=checked]:hover:border-project/15 data-[state=checked]:hover:bg-project/30",+ org: "data-[state=checked]:border-org/10 data-[state=checked]:bg-org/25 data-[state=checked]:hover:border-org/15 data-[state=checked]:hover:bg-org/30","sub-org":- "data-[state=checked]:border-sub-org/25 data-[state=checked]:bg-sub-org/10 data-[state=checked]:hover:bg-sub-org/15 data-[state=checked]:hover:border-sub-org/30",+ "data-[state=checked]:border-sub-org/10 data-[state=checked]:bg-sub-org/25 data-[state=checked]:hover:border-sub-org/15 data-[state=checked]:hover:bg-sub-org/30",success:- "data-[state=checked]:border-success/25 data-[state=checked]:bg-success/10 data-[state=checked]:hover:bg-success/15 data-[state=checked]:hover:border-success/30",- info: "data-[state=checked]:border-info/25 data-[state=checked]:bg-info/10 data-[state=checked]:hover:bg-info/15 data-[state=checked]:hover:border-info/30",+ "data-[state=checked]:border-success/10 data-[state=checked]:bg-success/25 data-[state=checked]:hover:border-success/15 data-[state=checked]:hover:bg-success/30",+ info: "data-[state=checked]:border-info/10 data-[state=checked]:bg-info/25 data-[state=checked]:hover:border-info/15 data-[state=checked]:hover:bg-info/30",warning:- "data-[state=checked]:border-warning/25 data-[state=checked]:bg-warning/10 data-[state=checked]:hover:bg-warning/15 data-[state=checked]:hover:border-warning/30",+ "data-[state=checked]:border-warning/10 data-[state=checked]:bg-warning/25 data-[state=checked]:hover:border-warning/15 data-[state=checked]:hover:bg-warning/30",danger:- "data-[state=checked]:border-danger/25 data-[state=checked]:bg-danger/10 data-[state=checked]:hover:bg-danger/15 data-[state=checked]:hover:border-danger/30",- pam: "data-[state=checked]:border-product-pam/25 data-[state=checked]:bg-product-pam/25 data-[state=checked]:hover:bg-product-pam/30 data-[state=checked]:hover:border-product-pam/30"+ "data-[state=checked]:border-danger/10 data-[state=checked]:bg-danger/25 data-[state=checked]:hover:border-danger/15 data-[state=checked]:hover:bg-danger/30",+ pam: "data-[state=checked]:border-product-pam/10 data-[state=checked]:bg-product-pam/25 data-[state=checked]:hover:border-product-pam/15 data-[state=checked]:hover:bg-product-pam/30"}},defaultVariants: {@@ -48,12 +48,12 @@ const switchVariants = cva(const switchThumbVariants = cva(cn(- "pointer-events-none block rounded-full ring-0 transition-all",+ "pointer-events-none block rounded-full shadow-xs ring-0 transition-all","ml-0.5 group-data-[size=default]/switch:size-3.5 group-data-[size=sm]/switch:size-2.5","group-data-[size=default]/switch:data-[state=unchecked]:translate-x-0",- "group-data-[size=default]/switch:data-[state=checked]:translate-x-[calc(100%-2px)]",+ "group-data-[size=default]/switch:data-[state=checked]:translate-x-4","group-data-[size=sm]/switch:data-[state=unchecked]:translate-x-0",- "group-data-[size=sm]/switch:data-[state=checked]:translate-x-[calc(100%-2px)]",+ "group-data-[size=sm]/switch:data-[state=checked]:translate-x-3","data-[state=unchecked]:border-foreground/5 data-[state=unchecked]:bg-foreground/15","data-[state=unchecked]:group-hover/switch:bg-foreground/35","data-[state=checked]:border-foreground/5 data-[state=checked]:bg-foreground/65",diff --git a/frontend/src/components/v3/platform/VerificationCode/VerificationCodeForm.stories.tsx b/frontend/src/components/v3/platform/VerificationCode/VerificationCodeForm.stories.tsxindex e060beec0e..c4252df534 100644--- a/frontend/src/components/v3/platform/VerificationCode/VerificationCodeForm.stories.tsx+++ b/frontend/src/components/v3/platform/VerificationCode/VerificationCodeForm.stories.tsx@@ -15,7 +15,7 @@ const meta = {},decorators: [(Story) => (- <div className="w-[28rem] max-w-[calc(100vw-2rem)]">+ <div className="w-full max-w-md"><Story /></div>)diff --git a/frontend/src/components/v3/platform/VerificationCode/VerificationCodeForm.tsx b/frontend/src/components/v3/platform/VerificationCode/VerificationCodeForm.tsxindex 536081285a..302de9f3cb 100644--- a/frontend/src/components/v3/platform/VerificationCode/VerificationCodeForm.tsx+++ b/frontend/src/components/v3/platform/VerificationCode/VerificationCodeForm.tsx@@ -53,6 +53,7 @@ type VerificationCodeFormProps = {name: string;onChange: (value: string) => void;onSubmit: () => void | Promise<void>;+ submitVariant?: React.ComponentProps<typeof Button>["variant"];value: string;};@@ -65,6 +66,7 @@ export const VerificationCodeForm = ({name,onChange,onSubmit,+ submitVariant = "project",value}: VerificationCodeFormProps) => {const isComplete = value.trim().length === fields;@@ -122,7 +124,7 @@ export const VerificationCodeForm = ({<AnimatedCollapse isOpen={hasFailedVerification}><Buttontype="submit"- variant="project"+ variant={submitVariant}size="lg"isFullWidthisPending={isPending}diff --git a/frontend/src/layouts/OrganizationLayout/components/OrgAlertBanner/OrgAlertBanner.tsx b/frontend/src/layouts/OrganizationLayout/components/OrgAlertBanner/OrgAlertBanner.tsxindex 518b7d1013..6c048bf425 100644--- a/frontend/src/layouts/OrganizationLayout/components/OrgAlertBanner/OrgAlertBanner.tsx+++ b/frontend/src/layouts/OrganizationLayout/components/OrgAlertBanner/OrgAlertBanner.tsx@@ -1,7 +1,6 @@-import { faArrowUpRightFromSquare, faWarning, faXmark } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";+import { ExternalLinkIcon, TriangleAlertIcon, XIcon } from "lucide-react";-import { IconButton } from "@app/components/v2";+import { IconButton } from "@app/components/v3";import { useToggle } from "@app/hooks";type Props = {@@ -15,37 +14,33 @@ export const OrgAlertBanner = ({ text, link }: Props) => {if (isDismissed) return null;return (- <div className="flex w-full items-center border-b border-yellow/50 bg-yellow/30 px-4 py-2 text-sm text-yellow-200">- <FontAwesomeIcon icon={faWarning} className="mr-2.5 text-base text-yellow" />- {text}{" "}- {link && (- <>- Learn how to configure it+ <div+ role="status"+ className="flex w-full items-start gap-2 border-b border-warning/20 bg-warning/5 px-4 py-2 text-sm text-foreground"+ >+ <TriangleAlertIcon className="mt-0.5 size-4 shrink-0 text-warning" />+ <p className="min-w-0 flex-1">+ {text}{" "}+ {link && (<ahref={link}rel="noopener noreferrer"target="_blank"- className="group flex items-center"+ className="inline-flex items-center gap-1 underline underline-offset-2 hover:text-warning">- <span className="cursor-pointer pl-1 underline underline-offset-2 duration-100 group-hover:text-mineshaft-100 group-hover:decoration-mineshaft-100">- here- </span>- <FontAwesomeIcon- className="mt-[0.12rem] ml-1 group-hover:text-mineshaft-100"- icon={faArrowUpRightFromSquare}- size="xs"- />+ Configuration documentation+ <ExternalLinkIcon className="size-3" /></a>- .- </>- )}+ )}+ </p><IconButton- className="ml-auto p-0 text-yellow-200"- ariaLabel="Dismiss banner"- variant="plain"+ className="-my-1 -mr-1"+ aria-label="Dismiss warning"+ variant="ghost-muted"+ size="xs"onClick={() => setIsDismissed.on()}>- <FontAwesomeIcon icon={faXmark} />+ <XIcon /></IconButton></div>);diff --git a/frontend/src/layouts/PersonalSettingsLayout/PersonalSettingsLayout.tsx b/frontend/src/layouts/PersonalSettingsLayout/PersonalSettingsLayout.tsxindex 2d90c11e3b..a4dd1bb3cc 100644--- a/frontend/src/layouts/PersonalSettingsLayout/PersonalSettingsLayout.tsx+++ b/frontend/src/layouts/PersonalSettingsLayout/PersonalSettingsLayout.tsx@@ -4,13 +4,11 @@ import { InsecureConnectionBanner } from "../OrganizationLayout/components/Insecexport const PersonalSettingsLayout = () => {return (- <div className="dark flex h-screen w-full flex-col overflow-x-hidden bg-bunker-800">+ <div className="dark flex h-screen w-full flex-col overflow-hidden bg-bunker-800">{!window.isSecureContext && <InsecureConnectionBanner />}- <div className="flex grow flex-col overflow-y-hidden md:flex-row">- <main className="flex-1 overflow-x-hidden overflow-y-auto bg-bunker-800 px-6 py-10 md:px-12 dark:scheme-dark">- <Outlet />- </main>- </div>+ <main className="min-h-0 min-w-0 flex-1 overflow-y-auto dark:scheme-dark">+ <Outlet />+ </main></div>);};diff --git a/frontend/src/pages/user/PersonalSettingsPage/PersonalSettingsPage.tsx b/frontend/src/pages/user/PersonalSettingsPage/PersonalSettingsPage.tsxindex eb00b6bcba..4b972b0d2d 100644--- a/frontend/src/pages/user/PersonalSettingsPage/PersonalSettingsPage.tsx+++ b/frontend/src/pages/user/PersonalSettingsPage/PersonalSettingsPage.tsx@@ -1,42 +1,52 @@import { Helmet } from "react-helmet";import { useTranslation } from "react-i18next";-import { faChevronLeft } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";-import { Link } from "@tanstack/react-router";+import { Link, useNavigate, useSearch } from "@tanstack/react-router";+import { ArrowLeftIcon } from "lucide-react";import { WishForm } from "@app/components/features/WishForm";-import { PageHeader } from "@app/components/v2";import { PersonalTabGroup } from "./components/PersonalTabGroup";export const PersonalSettingsPage = () => {const { t } = useTranslation();+ const navigate = useNavigate({ from: "/personal-settings/" });+ const { selectedTab } = useSearch({+ from: "/_authenticate/personal-settings/_layout/"+ });return (- <div className="h-full bg-bunker-800 pt-10 text-white">+ <div className="mx-auto w-full max-w-5xl p-4 lg:p-8"><Helmet><title>{t("common.head-title", { title: t("settings.personal.title") })}</title><link rel="icon" href="/infisical.ico" /></Helmet>- <div className="flex w-full justify-center px-6 text-white">- <div className="w-full max-w-8xl">- <Link to="/" className="mb-4 flex items-center gap-x-2 text-sm text-mineshaft-400">- <FontAwesomeIcon icon={faChevronLeft} />- Back to Organization- </Link>- <PageHeader- title="Personal Settings"- scope={null}- description="Configure settings for your account"- >- <div>- {window.location.origin.includes("https://app.infisical.com") ||- window.location.origin.includes("https://gamma.infisical.com") || <WishForm />}- </div>- </PageHeader>- <PersonalTabGroup />+ <Link+ to="/"+ className="mb-6 inline-flex items-center gap-2 rounded-sm text-sm text-muted transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none"+ >+ <ArrowLeftIcon className="size-4" />+ Back to organization+ </Link>+ <header className="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">+ <div className="grid gap-1">+ <h1 className="font-alliance text-2xl font-semibold text-foreground">+ Personal Settings+ </h1>+ <p className="text-sm text-muted">+ Manage your profile, authentication, and active sessions.+ </p></div>- </div>+ {!window.location.origin.includes("https://app.infisical.com") &&+ !window.location.origin.includes("https://gamma.infisical.com") && <WishForm />}+ </header>+ <PersonalTabGroup+ selectedTab={selectedTab}+ onTabChange={(nextTab) =>+ navigate({+ search: (previous) => ({ ...previous, selectedTab: nextTab })+ })+ }+ /></div>);};diff --git a/frontend/src/pages/user/PersonalSettingsPage/components/AuthMethodSection/AuthMethodSection.tsx b/frontend/src/pages/user/PersonalSettingsPage/components/AuthMethodSection/AuthMethodSection.tsxindex 9996f23801..7321bbde36 100644--- a/frontend/src/pages/user/PersonalSettingsPage/components/AuthMethodSection/AuthMethodSection.tsx+++ b/frontend/src/pages/user/PersonalSettingsPage/components/AuthMethodSection/AuthMethodSection.tsx@@ -1,30 +1,42 @@import { useEffect } from "react";import { useForm } from "react-hook-form";-import { faGithub, faGitlab, faGoogle, IconDefinition } from "@fortawesome/free-brands-svg-icons";-import { faEnvelope } from "@fortawesome/free-regular-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { zodResolver } from "@hookform/resolvers/zod";+import { jwtDecode } from "jwt-decode";+import { ChromeIcon, GithubIcon, GitlabIcon, LucideIcon, MailIcon } from "lucide-react";import { z } from "zod";import { createNotification } from "@app/components/notifications";-import { Switch } from "@app/components/v2";+import {+ Badge,+ Card,+ CardContent,+ CardDescription,+ CardHeader,+ CardTitle,+ Field,+ FieldContent,+ FieldDescription,+ FieldLabel,+ Switch+} from "@app/components/v3";import { useServerConfig, useUser } from "@app/context";import { useUpdateUserAuthMethods } from "@app/hooks/api";import { LoginMethod } from "@app/hooks/api/admin/types";+import { getAuthToken } from "@app/hooks/api/reactQuery";import { AuthMethod } from "@app/hooks/api/users/types";interface AuthMethodOption {label: string;value: AuthMethod;- icon: IconDefinition;+ icon: LucideIcon;loginMethod: LoginMethod;}const authMethodOpts: AuthMethodOption[] = [- { label: "Email", value: AuthMethod.EMAIL, icon: faEnvelope, loginMethod: LoginMethod.EMAIL },- { label: "Google", value: AuthMethod.GOOGLE, icon: faGoogle, loginMethod: LoginMethod.GOOGLE },- { label: "GitHub", value: AuthMethod.GITHUB, icon: faGithub, loginMethod: LoginMethod.GITHUB },- { label: "GitLab", value: AuthMethod.GITLAB, icon: faGitlab, loginMethod: LoginMethod.GITLAB }+ { label: "Email", value: AuthMethod.EMAIL, icon: MailIcon, loginMethod: LoginMethod.EMAIL },+ { label: "Google", value: AuthMethod.GOOGLE, icon: ChromeIcon, loginMethod: LoginMethod.GOOGLE },+ { label: "GitHub", value: AuthMethod.GITHUB, icon: GithubIcon, loginMethod: LoginMethod.GITHUB },+ { label: "GitLab", value: AuthMethod.GITLAB, icon: GitlabIcon, loginMethod: LoginMethod.GITLAB }];const schema = z.object({authMethods: z.nativeEnum(AuthMethod).array()@@ -32,10 +44,21 @@ const schema = z.object({export type FormData = z.infer<typeof schema>;+const getCurrentAuthMethod = () => {+ const authToken = getAuthToken();+ if (!authToken) return undefined;++ try {+ return jwtDecode<{ authMethod?: AuthMethod }>(authToken).authMethod;+ } catch {+ return undefined;+ }+};+export const AuthMethodSection = () => {const { user } = useUser();const { config } = useServerConfig();- const { mutateAsync } = useUpdateUserAuthMethods();+ const { mutateAsync, isPending } = useUpdateUserAuthMethods();const { reset, setValue, watch } = useForm<FormData>({defaultValues: {@@ -45,6 +68,7 @@ export const AuthMethodSection = () => {});const authMethods = watch("authMethods");+ const currentAuthMethod = getCurrentAuthMethod();useEffect(() => {if (user) {@@ -59,46 +83,30 @@ export const AuthMethodSection = () => {? [...authMethods, authMethodOpt.value]: authMethods.filter((auth) => auth !== authMethodOpt.value);- if (value) {+ try {const newUser = await mutateAsync({authMethods: newAuthMethods});setValue("authMethods", newUser.authMethods);createNotification({- text: "Successfully enabled authentication method",+ text: `${authMethodOpt.label} authentication ${value ? "enabled" : "disabled"}.`,type: "success"});- return;- }-- if (newAuthMethods.length === 0) {- createNotification({- text: "You must keep at least 1 authentication method enabled",- type: "error"- });- return;+ } catch {+ // MutationCache.onError handles the error notification.}-- const newUser = await mutateAsync({- authMethods: newAuthMethods- });-- setValue("authMethods", newUser.authMethods);- createNotification({- text: "Successfully disabled authentication method",- type: "success"- });};return (- <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">- <h2 className="mb-8 flex-1 text-xl font-medium text-mineshaft-100">Authentication methods</h2>- <p className="mb-4 text-gray-400">- By enabling a SSO provider, you are allowing an account with that provider which uses the- same email address as your existing Infisical account to be able to log in to Infisical.- </p>- <div className="mb-4">+ <Card className="gap-0 overflow-hidden p-0">+ <CardHeader className="p-6">+ <CardTitle className="font-alliance">Authentication Methods</CardTitle>+ <CardDescription>+ Choose which providers can sign in to your Infisical account using the same email address.+ </CardDescription>+ </CardHeader>+ <CardContent className="divide-y divide-border px-6 pb-6">{user &&authMethodOpts.map((authMethodOpt) => {// only filter when enabledLoginMethods is explicitly configured by admin@@ -109,22 +117,50 @@ export const AuthMethodSection = () => {return null;}+ const isEnabled = authMethods?.includes(authMethodOpt.value) ?? false;+ const isOnlyMethod = isEnabled && authMethods.length === 1;+ const descriptionId = `enable-${authMethodOpt.value}-auth-description`;+ const Icon = authMethodOpt.icon;+return (- <div className="flex items-center p-4" key={`auth-method-${authMethodOpt.value}`}>- <div className="flex items-center">- <FontAwesomeIcon icon={authMethodOpt.icon} className="mr-4" />- </div>+ <Field+ orientation="horizontal"+ className="grid grid-cols-[1.5rem_minmax(0,1fr)_auto] items-start gap-x-3 gap-y-0.5 py-4"+ key={`auth-method-${authMethodOpt.value}`}+ data-disabled={isPending || isOnlyMethod}+ >+ <Icon className="row-span-2 row-start-1 size-6 text-muted" />+ <FieldContent className="contents">+ <div className="col-start-2 row-start-1 flex min-w-0 items-center gap-2">+ <FieldLabel+ htmlFor={`enable-${authMethodOpt.value}-auth`}+ className="cursor-pointer text-sm font-medium text-foreground"+ >+ {authMethodOpt.label}+ </FieldLabel>+ {currentAuthMethod === authMethodOpt.value && (+ <Badge variant="neutral">Current session</Badge>+ )}+ </div>+ <FieldDescription id={descriptionId} className="col-start-2 row-start-2 text-sm">+ {isOnlyMethod+ ? "Keep at least one authentication method enabled."+ : `Allow sign-in with ${authMethodOpt.label}.`}+ </FieldDescription>+ </FieldContent><Switch+ className="col-start-3 row-span-2 row-start-1 self-center"id={`enable-${authMethodOpt.value}-auth`}onCheckedChange={(value) => onAuthMethodToggle(value, authMethodOpt)}- isChecked={authMethods?.includes(authMethodOpt.value) ?? false}- >- <p className="mr-4 w-12">{authMethodOpt.label}</p>- </Switch>- </div>+ checked={isEnabled}+ disabled={isPending || isOnlyMethod}+ aria-describedby={descriptionId}+ variant="project"+ />+ </Field>);})}- </div>- </div>+ </CardContent>+ </Card>);};diff --git a/frontend/src/pages/user/PersonalSettingsPage/components/ChangeEmailSection/ChangeEmailSection.tsx b/frontend/src/pages/user/PersonalSettingsPage/components/ChangeEmailSection/ChangeEmailSection.tsxindex c293f8f3a9..dae2311cb6 100644--- a/frontend/src/pages/user/PersonalSettingsPage/components/ChangeEmailSection/ChangeEmailSection.tsx+++ b/frontend/src/pages/user/PersonalSettingsPage/components/ChangeEmailSection/ChangeEmailSection.tsx@@ -1,19 +1,29 @@-import { useState } from "react";+import { useEffect, useRef, useState } from "react";import { Controller, useForm, useWatch } from "react-hook-form";import { zodResolver } from "@hookform/resolvers/zod";import { useNavigate } from "@tanstack/react-router";import { z } from "zod";import { createNotification } from "@app/components/notifications";-import { Button, FormControl, Input } from "@app/components/v2";import {- Button as V3Button,+ Button,+ Card,+ CardContent,+ CardDescription,+ CardFooter,+ CardHeader,+ CardTitle,Dialog,DialogContent,DialogDescription,DialogFooter,DialogHeader,DialogTitle,+ Field,+ FieldDescription,+ FieldError,+ FieldLabel,+ Input,VerificationCodeForm} from "@app/components/v3";import { useUser } from "@app/context";@@ -42,6 +52,14 @@ export const ChangeEmailSection = () => {const [otpStep, setOtpStep] = useState<OtpStep | null>(null);const [pendingEmail, setPendingEmail] = useState("");const [typedOTP, setTypedOTP] = useState("");+ const redirectTimer = useRef<ReturnType<typeof setTimeout> | null>(null);++ useEffect(+ () => () => {+ if (redirectTimer.current) clearTimeout(redirectTimer.current);+ },+ []+ );const emailForm = useForm<EmailFormData>({defaultValues: { newEmail: "" },@@ -96,7 +114,7 @@ export const ChangeEmailSection = () => {setOtpStep("currentEmail");createNotification({- text: "Verification code sent to your current email address. Check your inbox!",+ text: "Verification code sent to your current email address.",type: "success"});};@@ -152,7 +170,7 @@ export const ChangeEmailSection = () => {resetFlow();clearSession();- setTimeout(() => {+ redirectTimer.current = setTimeout(() => {navigate({ to: "/login" });}, 2000);};@@ -170,57 +188,65 @@ export const ChangeEmailSection = () => {return (<>- <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">- <h2 className="mb-8 flex-1 text-xl font-medium text-mineshaft-100">Change email</h2>-- <form onSubmit={emailForm.handleSubmit(handleEmailSubmit)}>- <div className="max-w-md">+ <form onSubmit={emailForm.handleSubmit(handleEmailSubmit)}>+ <Card className="gap-0 overflow-hidden p-0">+ <CardHeader className="p-6">+ <CardTitle className="font-alliance">Change Email</CardTitle>+ <CardDescription>+ Verify both your current and new email addresses. A successful change signs you out.+ </CardDescription>+ </CardHeader>+ <CardContent className="max-w-md px-6 pb-6"><Controllercontrol={emailForm.control}name="newEmail"render={({ field, fieldState: { error } }) => (- <FormControl- label="New email address"- isError={Boolean(error)}- errorText={error?.message}- tooltipText={- hasEmailAuth- ? "Your email authentication method is currently enabled and will remain active after changing your email."- : "Email authentication method will be automatically enabled after changing your email. You may disable email authentication after logging in with your new email if needed."- }- >+ <Field data-invalid={Boolean(error)}>+ <FieldLabel htmlFor="new-email-address">New email address</FieldLabel><Input+ id="new-email-address"{...field}placeholder="Enter new email address"type="email"- className="bg-mineshaft-800"+ autoComplete="email"+ aria-invalid={Boolean(error)}/>- </FormControl>+ <FieldDescription>+ {hasEmailAuth+ ? "Email authentication remains enabled after the change."+ : "Email authentication will be enabled automatically. You can change it after signing in with your new email."}+ </FieldDescription>+ <FieldError errors={[error]} />+ </Field>)}/>- </div>- <Button- type="submit"- colorSchema="secondary"- isLoading={isRequestingOTP}- isDisabled={isRequestingOTP || !isEmailValid(watchedEmail)}- >- Send Verification Code- </Button>- <p className="mt-2 font-inter text-sm text-mineshaft-400">- We'll first send a 6-digit code to your current email to confirm the change. After- you approve, a second code will be sent to your new email to finalize it.- </p>- </form>- </div>+ </CardContent>+ <CardFooter className="min-h-8 justify-end border-t border-neutral/15 bg-neutral/5 p-4 pl-6">+ <Button+ type="submit"+ variant="neutral"+ size="sm"+ isPending={isRequestingOTP}+ isDisabled={!isEmailValid(watchedEmail) || isOtpModalOpen}+ >+ Send verification code+ </Button>+ </CardFooter>+ </Card>+ </form><Dialogopen={isOtpModalOpen}- onOpenChange={(isOpen) => {- if (!isOpen) closeOtpModal();+ onOpenChange={(open) => {+ if (!open && !isOtpSubmitLoading) closeOtpModal();}}>- <DialogContent className="sm:max-w-xl">+ <DialogContent+ className="sm:max-w-md"+ onEscapeKeyDown={(event) => isOtpSubmitLoading && event.preventDefault()}+ onInteractOutside={(event) => isOtpSubmitLoading && event.preventDefault()}+ showCloseButton={!isOtpSubmitLoading}+ ><DialogHeader><DialogTitle>{otpTitle}</DialogTitle><DialogDescription>@@ -233,19 +259,25 @@ export const ChangeEmailSection = () => {value={typedOTP}onChange={setTypedOTP}onSubmit={onOtpSubmit}+ submitVariant="neutral"isPending={isOtpSubmitLoading}>{otpStep === "newEmail" && (- <p className="text-center text-xs text-mineshaft-400">+ <p className="text-center text-xs text-muted">Didn't get a code? If the new address already belongs to another Infisicalaccount, we've sent it an email explaining why the change can't becompleted.</p>)}<DialogFooter>- <V3Button type="button" variant="outline" onClick={closeOtpModal}>+ <Button+ type="button"+ variant="outline"+ onClick={closeOtpModal}+ isDisabled={isOtpSubmitLoading}+ >Cancel- </V3Button>+ </Button></DialogFooter></VerificationCodeForm></DialogContent>diff --git a/frontend/src/pages/user/PersonalSettingsPage/components/ChangePasswordSection/ChangePasswordSection.tsx b/frontend/src/pages/user/PersonalSettingsPage/components/ChangePasswordSection/ChangePasswordSection.tsxindex cc38ce4e4a..af3b084a17 100644--- a/frontend/src/pages/user/PersonalSettingsPage/components/ChangePasswordSection/ChangePasswordSection.tsx+++ b/frontend/src/pages/user/PersonalSettingsPage/components/ChangePasswordSection/ChangePasswordSection.tsx@@ -7,7 +7,20 @@ import { PasswordField } from "@app/components/auth/PasswordField";import { createNotification } from "@app/components/notifications";import { createPasswordSchema } from "@app/components/utilities/checks/password/passwordPolicy";import { usePasswordBreachCheck } from "@app/components/utilities/checks/password/usePasswordBreachCheck";-import { Button, FormControl, Input } from "@app/components/v2";+import {+ Button,+ Card,+ CardContent,+ CardDescription,+ CardFooter,+ CardHeader,+ CardTitle,+ Field,+ FieldError,+ FieldGroup,+ FieldLabel,+ Input+} from "@app/components/v3";import { useServerConfig, useUser } from "@app/context";import { TPasswordPolicy } from "@app/hooks/api/admin/types";import { useResetUserPasswordV2, useSendPasswordSetupEmail } from "@app/hooks/api/auth/queries";@@ -78,83 +91,100 @@ export const ChangePasswordSection = () => {clearSession();createNotification({- text: "Successfully changed password",+ text: "Password changed.",type: "success"});reset();navigate({ to: "/login" });- } catch (err) {- console.error(err);+ } catch {createNotification({- text: "Failed to change password",+ text: "Failed to change password.",type: "error"});}};const onSetupPassword = async () => {- await sendSetupPasswordEmail.mutateAsync();-- createNotification({- title: "Password setup verification email sent",- text: "Check your email to confirm password setup",- type: "info"- });+ try {+ await sendSetupPasswordEmail.mutateAsync();+ createNotification({+ title: "Password setup email sent",+ text: "Check your email to continue setting up a password.",+ type: "info"+ });+ } catch {+ createNotification({+ text: "Failed to send password setup email.",+ type: "error"+ });+ }};return (- <form- onSubmit={handleSubmit(onFormSubmit)}- className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4"- >- <h2 className="mb-8 flex-1 text-xl font-medium text-mineshaft-100">Change password</h2>- <div className="max-w-md">- <Controller- defaultValue=""- render={({ field, fieldState: { error } }) => (- <FormControl isError={Boolean(error)} errorText={error?.message}>- <Input- placeholder="Old password"- type="password"- {...field}- className="bg-mineshaft-800"- />- </FormControl>- )}- control={control}- name="oldPassword"- />- </div>- <div className="max-w-md">- <PasswordField- id="change-password-new-password"- value={newPassword}- policy={config.passwordPolicy}- breachStatus={breachStatus}- registration={register("newPassword")}- error={errors.newPassword}- submitCount={submitCount}- />- </div>- <Button- type="submit"- colorSchema="secondary"- isLoading={isSubmitting}- isDisabled={isSubmitting || breachStatus === "checking" || breachStatus === "breached"}- >- Save- </Button>- <p className="mt-2 font-inter text-sm text-mineshaft-400">- Need to setup a password?{" "}- <button- onClick={onSetupPassword}- type="button"- className="underline underline-offset-2 hover:text-mineshaft-200"- >- Click here- </button>- </p>+ <form onSubmit={handleSubmit(onFormSubmit)}>+ <Card className="gap-0 overflow-hidden p-0">+ <CardHeader className="p-6">+ <CardTitle className="font-alliance">Change Password</CardTitle>+ <CardDescription>+ Changing your password signs this session out after the update succeeds.+ </CardDescription>+ </CardHeader>+ <CardContent className="max-w-md px-6 pb-6">+ <FieldGroup>+ <Controller+ defaultValue=""+ render={({ field, fieldState: { error } }) => (+ <Field data-invalid={Boolean(error)}>+ <FieldLabel htmlFor="change-password-current-password">+ Current password+ </FieldLabel>+ <Input+ id="change-password-current-password"+ type="password"+ autoComplete="current-password"+ aria-invalid={Boolean(error)}+ {...field}+ />+ <FieldError errors={[error]} />+ </Field>+ )}+ control={control}+ name="oldPassword"+ />+ <PasswordField+ id="change-password-new-password"+ label="New password"+ value={newPassword}+ policy={config.passwordPolicy}+ breachStatus={breachStatus}+ registration={register("newPassword")}+ error={errors.newPassword}+ submitCount={submitCount}+ />+ </FieldGroup>+ </CardContent>+ <CardFooter className="min-h-8 flex-wrap justify-end gap-2 border-t border-neutral/15 bg-neutral/5 p-4 pl-6">+ <Button+ type="submit"+ variant="neutral"+ size="sm"+ isPending={isSubmitting}+ isDisabled={breachStatus === "checking" || breachStatus === "breached"}+ >+ Change password+ </Button>+ <Button+ onClick={onSetupPassword}+ type="button"+ variant="outline"+ size="sm"+ isPending={sendSetupPasswordEmail.isPending}+ >+ Email setup link+ </Button>+ </CardFooter>+ </Card></form>);};diff --git a/frontend/src/pages/user/PersonalSettingsPage/components/DeleteAccountSection/DeleteAccountSection.tsx b/frontend/src/pages/user/PersonalSettingsPage/components/DeleteAccountSection/DeleteAccountSection.tsxindex 301942346e..9d965b3fed 100644--- a/frontend/src/pages/user/PersonalSettingsPage/components/DeleteAccountSection/DeleteAccountSection.tsx+++ b/frontend/src/pages/user/PersonalSettingsPage/components/DeleteAccountSection/DeleteAccountSection.tsx@@ -1,51 +1,119 @@+import { useState } from "react";import { useNavigate } from "@tanstack/react-router";+import { Trash2Icon } from "lucide-react";import { createNotification } from "@app/components/notifications";-import { Button, DeleteActionModal } from "@app/components/v2";+import {+ AlertDialog,+ AlertDialogAction,+ AlertDialogCancel,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogHeader,+ AlertDialogTitle,+ Button,+ Card,+ CardDescription,+ CardFooter,+ CardHeader,+ CardTitle,+ Field,+ FieldDescription,+ FieldLabel,+ Input+} from "@app/components/v3";import { useDeleteMe } from "@app/hooks/api";-import { usePopUp } from "@app/hooks/usePopUp";++const DELETE_CONFIRMATION = "delete my account";export const DeleteAccountSection = () => {const navigate = useNavigate();-- const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([- "deleteAccount"- ] as const);+ const [isOpen, setIsOpen] = useState(false);+ const [confirmation, setConfirmation] = useState("");const { mutateAsync: deleteUserMutateAsync, isPending } = useDeleteMe();const handleDeleteAccountSubmit = async () => {- await deleteUserMutateAsync();+ try {+ await deleteUserMutateAsync();- createNotification({- text: "Successfully deleted account",- type: "success"- });+ createNotification({+ text: "Account deleted.",+ type: "success"+ });- navigate({ to: "/login" });- handlePopUpClose("deleteAccount");+ setIsOpen(false);+ navigate({ to: "/login" });+ } catch {+ createNotification({+ text: "Failed to delete account.",+ type: "error"+ });+ }};return (- <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">- <p className="mb-4 text-xl font-medium text-mineshaft-100">Danger Zone</p>- <Button- isLoading={isPending}- colorSchema="danger"- variant="outline_bg"- type="submit"- onClick={() => handlePopUpOpen("deleteAccount")}+ <>+ <Card className="gap-0 overflow-hidden border-danger/25 p-0">+ <CardHeader className="p-6">+ <CardTitle className="font-alliance">Delete Account</CardTitle>+ <CardDescription>+ Permanently delete your account and revoke its access to Infisical. This cannot be+ undone.+ </CardDescription>+ </CardHeader>+ <CardFooter className="min-h-8 justify-end border-t border-danger/15 bg-danger/5 p-4">+ <Button variant="danger" size="sm" onClick={() => setIsOpen(true)}>+ <Trash2Icon />+ Delete account+ </Button>+ </CardFooter>+ </Card>++ <AlertDialog+ open={isOpen}+ onOpenChange={(open) => {+ if (isPending) return;+ setIsOpen(open);+ if (!open) setConfirmation("");+ }}>- Delete my account- </Button>- <DeleteActionModal- isOpen={popUp.deleteAccount.isOpen}- title="Are you sure you want to delete your account?"- subTitle="Permanently remove this account and all of its data. This action is not reversible, so please be careful."- onChange={(isOpen) => handlePopUpToggle("deleteAccount", isOpen)}- deleteKey="confirm"- onDeleteApproved={handleDeleteAccountSubmit}- />- </div>+ <AlertDialogContent>+ <AlertDialogHeader>+ <AlertDialogTitle>Delete your account?</AlertDialogTitle>+ <AlertDialogDescription>+ Your account will permanently lose access to Infisical. This cannot be undone.+ </AlertDialogDescription>+ </AlertDialogHeader>+ <Field>+ <FieldLabel htmlFor="delete-account-confirmation">+ Type <span className="font-mono">{DELETE_CONFIRMATION}</span> to continue+ </FieldLabel>+ <Input+ id="delete-account-confirmation"+ value={confirmation}+ onChange={(event) => setConfirmation(event.target.value)}+ autoComplete="off"+ />+ <FieldDescription>This confirmation is case-sensitive.</FieldDescription>+ </Field>+ <AlertDialogFooter>+ <AlertDialogCancel isDisabled={isPending}>Cancel</AlertDialogCancel>+ <AlertDialogAction+ variant="danger"+ isPending={isPending}+ isDisabled={confirmation !== DELETE_CONFIRMATION}+ onClick={(event) => {+ event.preventDefault();+ handleDeleteAccountSubmit();+ }}+ >+ Delete account+ </AlertDialogAction>+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog>+ </>);};diff --git a/frontend/src/pages/user/PersonalSettingsPage/components/PersonalAuthTab/PersonalAuthTab.tsx b/frontend/src/pages/user/PersonalSettingsPage/components/PersonalAuthTab/PersonalAuthTab.tsxindex 2230f1a004..8fea82d12d 100644--- a/frontend/src/pages/user/PersonalSettingsPage/components/PersonalAuthTab/PersonalAuthTab.tsx+++ b/frontend/src/pages/user/PersonalSettingsPage/components/PersonalAuthTab/PersonalAuthTab.tsx@@ -1,3 +1,6 @@+import { AlertCircleIcon } from "lucide-react";++import { Alert, AlertDescription, AlertTitle, Button, Card, Skeleton } from "@app/components/v3";import { useGetUser } from "@app/hooks/api";import { AuthMethod } from "@app/hooks/api/users/types";@@ -7,17 +10,41 @@ import { ChangePasswordSection } from "../ChangePasswordSection";import { MFASection } from "../SecuritySection";export const PersonalAuthTab = () => {- const { data: user } = useGetUser();+ const { data: user, isPending, isError, refetch } = useGetUser();++ if (isError) {+ return (+ <Alert variant="danger">+ <AlertCircleIcon />+ <AlertTitle>Authentication settings could not be loaded</AlertTitle>+ <AlertDescription>+ <Button variant="outline" size="sm" onClick={() => refetch()}>+ Retry+ </Button>+ </AlertDescription>+ </Alert>+ );+ }++ if (isPending || !user) {+ return (+ <Card aria-label="Loading authentication settings">+ <Skeleton className="h-6 w-56" />+ <Skeleton className="h-24 w-full" />+ </Card>+ );+ }+return (- <div>- {user && !user.authMethods.includes(AuthMethod.LDAP) && (+ <div className="flex flex-col gap-6">+ {!user.authMethods.includes(AuthMethod.LDAP) && (<><MFASection /><AuthMethodSection /></>)}<ChangePasswordSection />- {user && !user.authMethods.includes(AuthMethod.LDAP) && <ChangeEmailSection />}+ {!user.authMethods.includes(AuthMethod.LDAP) && <ChangeEmailSection />}</div>);};diff --git a/frontend/src/pages/user/PersonalSettingsPage/components/PersonalGeneralTab/PersonalGeneralTab.tsx b/frontend/src/pages/user/PersonalSettingsPage/components/PersonalGeneralTab/PersonalGeneralTab.tsxindex 025c2d0e43..e71ef6a396 100644--- a/frontend/src/pages/user/PersonalSettingsPage/components/PersonalGeneralTab/PersonalGeneralTab.tsx+++ b/frontend/src/pages/user/PersonalSettingsPage/components/PersonalGeneralTab/PersonalGeneralTab.tsx@@ -4,7 +4,7 @@ import { UserNameSection } from "../UserNameSection";export const PersonalGeneralTab = () => {return (- <div>+ <div className="flex flex-col gap-6"><UserNameSection /><SessionsSection /><DeleteAccountSection />diff --git a/frontend/src/pages/user/PersonalSettingsPage/components/PersonalTabGroup/PersonalTabGroup.tsx b/frontend/src/pages/user/PersonalSettingsPage/components/PersonalTabGroup/PersonalTabGroup.tsxindex d8987986a7..39ed1d03f2 100644--- a/frontend/src/pages/user/PersonalSettingsPage/components/PersonalTabGroup/PersonalTabGroup.tsx+++ b/frontend/src/pages/user/PersonalSettingsPage/components/PersonalTabGroup/PersonalTabGroup.tsx@@ -1,67 +1,80 @@-import { faWarning } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";+import { ExternalLinkIcon, KeyRoundIcon, TriangleAlertIcon } from "lucide-react";-import { Tab, TabList, TabPanel, Tabs } from "@app/components/v2";+import {+ Alert,+ AlertDescription,+ AlertTitle,+ Tabs,+ TabsContent,+ TabsList,+ TabsTrigger+} from "@app/components/v3";import { PersonalAuthTab } from "../PersonalAuthTab";import { PersonalGeneralTab } from "../PersonalGeneralTab";+type PersonalSettingsTab = "general" | "authentication" | "api-keys";++type Props = {+ selectedTab: PersonalSettingsTab;+ onTabChange: (tab: PersonalSettingsTab) => void;+};+const tabs = [- { name: "General", key: "tab-account-general" },- { name: "Authentication", key: "tab-account-auth" },- { name: "API Keys", key: "tab-account-api-keys" }-];+ { name: "General", key: "general" },+ { name: "Authentication", key: "authentication" },+ { name: "API keys", key: "api-keys", icon: TriangleAlertIcon }+] satisfies { name: string; key: PersonalSettingsTab; icon?: typeof TriangleAlertIcon }[];-export const PersonalTabGroup = () => {+export const PersonalTabGroup = ({ selectedTab, onTabChange }: Props) => {return (- <Tabs orientation="vertical" defaultValue={tabs[0].key}>- <TabList>- {tabs.map((tab) => (- <Tab value={tab.key} key={tab.key} variant="instance">- {tab.name}- </Tab>+ <Tabs+ value={selectedTab}+ onValueChange={(value) => onTabChange(value as PersonalSettingsTab)}+ className="mt-8"+ >+ <TabsList variant="admin" aria-label="Personal settings sections">+ {tabs.map(({ name, key, icon: Icon }) => (+ <TabsTrigger value={key} key={key}>+ {Icon && <Icon aria-hidden className="text-warning" />}+ {name}+ </TabsTrigger>))}- </TabList>- <TabPanel value={tabs[0].key}>+ </TabsList>+ <TabsContent value="general"><PersonalGeneralTab />- </TabPanel>- <TabPanel value={tabs[1].key}>+ </TabsContent>+ <TabsContent value="authentication"><PersonalAuthTab />- </TabPanel>- <TabPanel value={tabs[2].key}>- <div className="space-y-3">- <div className="mt-4 flex w-full flex-row items-center rounded-md border border-primary-600/70 bg-primary/[.07] p-4 text-base text-white">- <FontAwesomeIcon icon={faWarning} className="pr-6 text-4xl text-white/80" />- <div className="flex w-full flex-col text-sm">- <span className="mb-4 text-lg font-medium">Deprecation Notice</span>- <p>- API Keys are being deprecated in favor of Machine Identities.- <br />- They will be removed in the future in accordance with the deprecation notice and- timeline stated{" "}- <a- href="https://infisical.com/blog/deprecating-api-keys"- target="_blank"- className="font-medium text-primary-400"- rel="noreferrer"- >- here- </a>- .- <br />- <a- href="https://infisical.com/docs/documentation/platform/identities/overview"- target="_blank"- className="font-medium text-primary-400"- rel="noreferrer"- >- Learn more about Machine Identities- </a>- </p>- </div>- </div>- </div>- </TabPanel>+ </TabsContent>+ <TabsContent value="api-keys">+ <Alert variant="warning">+ <KeyRoundIcon />+ <AlertTitle>API keys are deprecated</AlertTitle>+ <AlertDescription>+ <p>+ Use machine identities for programmatic access. API keys will be removed according to+ the published{" "}+ <a+ href="https://infisical.com/blog/deprecating-api-keys"+ target="_blank"+ rel="noreferrer"+ >+ deprecation timeline <ExternalLinkIcon className="inline size-3" />+ </a>+ {". See the "}+ <a+ href="https://infisical.com/docs/documentation/platform/identities/overview"+ target="_blank"+ rel="noreferrer"+ >+ machine identities documentation <ExternalLinkIcon className="inline size-3" />+ </a>+ .+ </p>+ </AlertDescription>+ </Alert>+ </TabsContent></Tabs>);};diff --git a/frontend/src/pages/user/PersonalSettingsPage/components/SecuritySection/MFASection.tsx b/frontend/src/pages/user/PersonalSettingsPage/components/SecuritySection/MFASection.tsxindex 690e44f2b6..bb4f9db786 100644--- a/frontend/src/pages/user/PersonalSettingsPage/components/SecuritySection/MFASection.tsx+++ b/frontend/src/pages/user/PersonalSettingsPage/components/SecuritySection/MFASection.tsx@@ -2,8 +2,9 @@ import { useState } from "react";import { CircleAlertIcon, PowerIcon, ShieldCheckIcon } from "lucide-react";import { MFA_METHOD_ICONS, MFA_METHOD_LABELS, RecoveryCodesView } from "@app/components/mfa/setup";-import { ContentLoader } from "@app/components/v2";import {+ Alert,+ AlertDescription,AlertDialog,AlertDialogAction,AlertDialogCancel,@@ -12,19 +13,26 @@ import {AlertDialogFooter,AlertDialogHeader,AlertDialogTitle,+ AlertTitle,Badge,Button,+ Card,+ CardContent,+ CardDescription,+ CardFooter,+ CardHeader,Dialog,DialogContent,DialogDescription,DialogHeader,DialogTitle,- DocumentationLinkBadge,Select,SelectContent,SelectItem,SelectTrigger,- SelectValue+ SelectValue,+ Separator,+ Skeleton} from "@app/components/v3";import { useGetOrganizations, useGetUser } from "@app/hooks/api";import { MfaMethod } from "@app/hooks/api/auth/types";@@ -39,18 +47,32 @@ import { useChangePreferredMfa } from "./useChangePreferredMfa";import { useDisableMfa } from "./useDisableMfa";import { useEnableMfa } from "./useEnableMfa";-const LEARN_MORE_URL = "https://infisical.com/docs/documentation/platform/mfa";-export const MFASection = () => {- const { data: user, isPending } = useGetUser();- const { changePreferredMfa } = useChangePreferredMfa();+ const { data: user, isPending, isError: isUserError, refetch: refetchUser } = useGetUser();+ const { changePreferredMfa, isBusy: isChangingPreferred } = useChangePreferredMfa();const { isBusy: isEnabling, enableMfa } = useEnableMfa();const { isBusy: isDisabling, disableMfa } = useDisableMfa();- const { data: totpConfiguration } = useGetUserTotpConfiguration();- const { data: webAuthnData } = useGetWebAuthnCredentials();+ const {+ data: totpConfiguration,+ isError: isTotpError,+ refetch: refetchTotp+ } = useGetUserTotpConfiguration();+ const {+ data: webAuthnData,+ isError: isWebAuthnError,+ refetch: refetchWebAuthn+ } = useGetWebAuthnCredentials();const webAuthnCredentials = webAuthnData?.credentials ?? [];- const { data: organizations = [] } = useGetOrganizations();- const { data: serverDetails } = useFetchServerStatus();+ const {+ data: organizations = [],+ isError: isOrganizationsError,+ refetch: refetchOrganizations+ } = useGetOrganizations();+ const {+ data: serverDetails,+ isError: isServerError,+ refetch: refetchServer+ } = useFetchServerStatus();const isMfaEnforced = organizations.some((org) => org.enforceMfa);const isEmailMfaAvailable = Boolean(serverDetails?.emailConfigured);@@ -68,18 +90,58 @@ export const MFASection = () => {setHasAcknowledgedCodes(false);};+ if (isUserError || isTotpError || isWebAuthnError || isOrganizationsError || isServerError) {+ return (+ <Alert variant="danger">+ <CircleAlertIcon />+ <AlertTitle>Two-factor authentication settings could not be loaded</AlertTitle>+ <AlertDescription>+ <p>Check your connection and try again.</p>+ <Button+ size="sm"+ variant="outline"+ onClick={() =>+ Promise.all([+ refetchUser(),+ refetchTotp(),+ refetchWebAuthn(),+ refetchOrganizations(),+ refetchServer()+ ])+ }+ >+ Retry+ </Button>+ </AlertDescription>+ </Alert>+ );+ }+if (isPending || !user) {- return <ContentLoader />;+ return (+ <Card aria-label="Loading two-factor authentication settings">+ <Skeleton className="h-6 w-64" />+ <Skeleton className="h-4 w-full max-w-2xl" />+ <Skeleton className="h-24 w-full" />+ </Card>+ );}if (user.authMethods?.includes(AuthMethod.LDAP)) {return (- <div className="rounded-lg border border-border bg-card p-4">- <h2 className="text-lg font-medium text-foreground">Two-factor Authentication</h2>- <p className="mt-1 text-sm text-muted">- Two-factor authentication is managed by your identity provider for LDAP accounts.- </p>- </div>+ <Card role="region" aria-labelledby="two-factor-authentication-title">+ <CardHeader>+ <h2+ id="two-factor-authentication-title"+ className="font-alliance text-lg leading-none font-semibold"+ >+ Two-Factor Authentication+ </h2>+ <CardDescription>+ Two-factor authentication is managed by your identity provider for LDAP accounts.+ </CardDescription>+ </CardHeader>+ </Card>);}@@ -113,13 +175,13 @@ export const MFASection = () => {// step-up flow as viewing recovery codes) before it goes through.const handleDisable = () => disableMfa(() => setIsDisableOpen(false));- const banner = (- <div className="p-6">- <div className="flex items-start justify-between">- <div className="flex items-center gap-2">- <h2 className="text-lg font-medium text-foreground">Two-factor Authentication</h2>- <DocumentationLinkBadge href={LEARN_MORE_URL} />- </div>+ const header = (+ <CardHeader className="p-6">+ <h2+ id="two-factor-authentication-title"+ className="flex flex-wrap items-center gap-1.5 font-alliance text-lg leading-none font-semibold"+ >+ Two-Factor Authentication{user.isMfaEnabled ? (<Badge variant="success"><ShieldCheckIcon /> Enabled@@ -129,92 +191,110 @@ export const MFASection = () => {<CircleAlertIcon /> Not enabled</Badge>)}- </div>- <p className="mt-2 max-w-2xl text-sm text-muted">+ </h2>+ <CardDescription>{user.isMfaEnabled- ? "Two-factor authentication is protecting your account. Manage your methods and recovery options below."+ ? "Manage your methods and recovery options.": "Two-factor authentication adds an additional layer of security to your account by requiring more than just a password to sign in."}- </p>+ </CardDescription>+ </CardHeader>+ );- <div className="mt-6 border-t border-border pt-6">- <p className="text-sm font-medium text-foreground">Preferred 2FA method</p>- <p className="mb-3 text-sm text-muted">- Set the method used first when signing in to Infisical.- </p>- <div className="max-w-xs">- <Select- value={selectedMethod}- onValueChange={(value) => handlePreferredMethodChange(value as MfaMethod)}+ const preferredMethodSection = (+ <section className="grid gap-4" aria-labelledby="preferred-2fa-method-title">+ <CardHeader>+ <div className="flex items-center gap-4">+ <h3+ id="preferred-2fa-method-title"+ className="shrink-0 font-alliance text-sm font-semibold">- <SelectTrigger className="w-full">- <SelectValue placeholder="Select a method" />- </SelectTrigger>- <SelectContent>- {availableMethods.map((method) => {- const Icon = MFA_METHOD_ICONS[method];- return (- <SelectItem key={method} value={method}>- <span className="flex items-center gap-2">- <Icon />- {MFA_METHOD_LABELS[method]}- </span>- </SelectItem>- );- })}- </SelectContent>- </Select>+ Preferred 2FA method+ </h3>+ <Separator className="flex-1" /></div>+ <CardDescription>Set the method used first when signing in to Infisical.</CardDescription>+ </CardHeader>+ <div className="max-w-xs">+ <Select+ value={selectedMethod}+ onValueChange={(value) => handlePreferredMethodChange(value as MfaMethod)}+ disabled={isChangingPreferred || availableMethods.length === 0}+ >+ <SelectTrigger className="w-full">+ <SelectValue placeholder="Select a method" />+ </SelectTrigger>+ <SelectContent>+ {availableMethods.map((method) => {+ const Icon = MFA_METHOD_ICONS[method];+ return (+ <SelectItem key={method} value={method}>+ <span className="flex items-center gap-2">+ <Icon />+ {MFA_METHOD_LABELS[method]}+ </span>+ </SelectItem>+ );+ })}+ </SelectContent>+ </Select></div>+ </section>+ );++ let footerDescription =+ "Set up an authenticator app or passkey below to enable two-factor authentication. Email codes are unavailable because SMTP is not configured for this instance.";- <div className="mt-6 flex items-center justify-between gap-4 border-t border-border pt-6">+ if (user.isMfaEnabled) {+ footerDescription = isMfaEnforced+ ? "Your organization requires two-factor authentication, so it can't be disabled."+ : "Turning this off keeps your configured methods, but your recovery codes are invalidated.";+ } else if (canEnable) {+ footerDescription =+ "Choose your preferred method above, then enable two-factor authentication.";+ }++ const footer = (+ <CardFooter className="min-h-8 flex-wrap justify-between gap-8 border-t border-neutral/15 bg-neutral/5 p-4 pl-6">+ <div className="min-w-0 flex-1">+ <p className="text-sm text-muted">{footerDescription}</p>+ </div>+ <div className="flex shrink-0 items-center gap-2">{user.isMfaEnabled ? (- <>- <p className="text-sm text-muted">- {isMfaEnforced- ? "Your organization requires two-factor authentication, so it can't be disabled."- : "Turning this off keeps your configured methods, but your recovery codes are invalidated."}- </p>- <Button- variant="danger"- isDisabled={isMfaEnforced}- onClick={() => setIsDisableOpen(true)}- >- <PowerIcon /> Disable two-factor authentication- </Button>- </>+ <Button+ variant="danger"+ isDisabled={isMfaEnforced}+ onClick={() => setIsDisableOpen(true)}+ >+ <PowerIcon /> Disable 2FA+ </Button>) : (- <>- <p className="text-sm text-muted">- {canEnable- ? "Choose your preferred method above, then enable two-factor authentication."- : "Set up an authenticator app or passkey below to enable two-factor authentication. Email codes are unavailable because SMTP is not configured for this instance."}- </p>- <Button- variant="org"- isDisabled={isEnabling || !canEnable}- onClick={() => setIsEnableOpen(true)}- >- <ShieldCheckIcon /> Enable two-factor authentication- </Button>- </>+ <Button+ variant="neutral"+ isDisabled={isEnabling || !canEnable}+ onClick={() => setIsEnableOpen(true)}+ >+ <ShieldCheckIcon /> Enable two-factor authentication+ </Button>)}</div>- </div>+ </CardFooter>);return (<>- <div className="mb-6 rounded-lg border border-border bg-card">- {banner}- <div className="mx-6 border-t border-border" />- <MfaMethodsCard />- {hasRecoveryCodes && (- <>- <div className="mx-6 border-t border-border" />- <RecoveryOptionsCard />- </>- )}- </div>+ <Card+ className="gap-0 overflow-hidden p-0"+ role="region"+ aria-labelledby="two-factor-authentication-title"+ >+ {header}+ <CardContent className="flex flex-col gap-6 px-6 pb-6">+ <MfaMethodsCard />+ {hasRecoveryCodes && <RecoveryOptionsCard />}+ {preferredMethodSection}+ </CardContent>+ {footer}+ </Card><AlertDialog open={isEnableOpen} onOpenChange={setIsEnableOpen}><AlertDialogContent>@@ -228,14 +308,17 @@ export const MFASection = () => {</AlertDialogHeader><AlertDialogFooter><AlertDialogCancel>Cancel</AlertDialogCancel>- <AlertDialogAction variant="org" isPending={isEnabling} onClick={handleEnable}>+ <AlertDialogAction variant="neutral" isPending={isEnabling} onClick={handleEnable}>Enable</AlertDialogAction></AlertDialogFooter></AlertDialogContent></AlertDialog>- <AlertDialog open={isDisableOpen} onOpenChange={setIsDisableOpen}>+ <AlertDialog+ open={isDisableOpen}+ onOpenChange={(open) => !isDisabling && setIsDisableOpen(open)}+ ><AlertDialogContent><AlertDialogHeader><AlertDialogTitle>Disable two-factor authentication?</AlertDialogTitle>@@ -246,8 +329,15 @@ export const MFASection = () => {</AlertDialogDescription></AlertDialogHeader><AlertDialogFooter>- <AlertDialogCancel>Cancel</AlertDialogCancel>- <AlertDialogAction variant="danger" isPending={isDisabling} onClick={handleDisable}>+ <AlertDialogCancel isDisabled={isDisabling}>Cancel</AlertDialogCancel>+ <AlertDialogAction+ variant="danger"+ isPending={isDisabling}+ onClick={(event) => {+ event.preventDefault();+ handleDisable();+ }}+ >Disable</AlertDialogAction></AlertDialogFooter>@@ -273,7 +363,7 @@ export const MFASection = () => {they are shown.</DialogDescription></DialogHeader>- <div className="max-h-[50vh] overflow-y-auto">+ <div className="max-h-80 overflow-y-auto"><RecoveryCodesViewrecoveryCodes={newRecoveryCodes ?? []}acknowledgment={{diff --git a/frontend/src/pages/user/PersonalSettingsPage/components/SecuritySection/MethodSetupDialog.tsx b/frontend/src/pages/user/PersonalSettingsPage/components/SecuritySection/MethodSetupDialog.tsxindex b3051e0a92..32b3788df9 100644--- a/frontend/src/pages/user/PersonalSettingsPage/components/SecuritySection/MethodSetupDialog.tsx+++ b/frontend/src/pages/user/PersonalSettingsPage/components/SecuritySection/MethodSetupDialog.tsx@@ -26,10 +26,11 @@ export const MethodSetupDialog = ({ method, onOpenChange, onCompleted }: Props)</DialogTitle><DialogDescription>Configure this method as a second factor.</DialogDescription></DialogHeader>- <div className="max-h-[60vh] overflow-y-auto">+ <div className="max-h-96 overflow-y-auto">{method && (<VerifyStepmethod={method}+ variant="neutral"onVerified={() => {onCompleted();onOpenChange(false);diff --git a/frontend/src/pages/user/PersonalSettingsPage/components/SecuritySection/MfaMethodsCard.tsx b/frontend/src/pages/user/PersonalSettingsPage/components/SecuritySection/MfaMethodsCard.tsxindex 63a6a75abc..b8d246561e 100644--- a/frontend/src/pages/user/PersonalSettingsPage/components/SecuritySection/MfaMethodsCard.tsx+++ b/frontend/src/pages/user/PersonalSettingsPage/components/SecuritySection/MfaMethodsCard.tsx@@ -34,18 +34,16 @@ type MethodRowProps = {};const MethodRow = ({ icon: Icon, title, description, badge, action }: MethodRowProps) => (- <div className="flex items-center justify-between gap-4 py-3">- <div className="flex items-start gap-3">- <Icon className="mt-0.5 text-muted" />- <div>- <div className="flex items-center gap-2">- <p className="text-sm text-foreground">{title}</p>- {badge}- </div>- <p className="text-xs text-muted">{description}</p>- </div>+ <div className="grid grid-cols-[1.5rem_minmax(0,1fr)] items-start gap-x-3 gap-y-0.5 py-3 sm:grid-cols-[1.5rem_minmax(0,1fr)_auto]">+ <Icon className="row-span-2 row-start-1 size-6 text-muted" />+ <div className="col-start-2 row-start-1 flex min-w-0 items-center gap-2">+ <p className="text-sm text-foreground">{title}</p>+ {badge}+ </div>+ <p className="col-start-2 row-start-2 text-sm text-muted">{description}</p>+ <div className="col-start-2 row-start-3 justify-self-end sm:col-start-3 sm:row-span-2 sm:row-start-1 sm:self-center">+ {action}</div>- <div className="shrink-0">{action}</div></div>);@@ -72,8 +70,7 @@ export const MfaMethodsCard = () => {const handleRemoveTotp = () => removeTotp(() => setIsRemoveTotpOpen(false));return (- <div className="p-6">- <h3 className="mb-2 text-sm font-medium text-foreground">Two-factor methods</h3>+ <section aria-label="Two-factor authentication methods"><div className="divide-y divide-border"><MethodRowicon={MFA_METHOD_ICONS[MfaMethod.EMAIL]}@@ -144,7 +141,10 @@ export const MfaMethodsCard = () => {<PasskeyManagerDialog isOpen={isPasskeyManagerOpen} onOpenChange={setIsPasskeyManagerOpen} />- <AlertDialog open={isRemoveTotpOpen} onOpenChange={setIsRemoveTotpOpen}>+ <AlertDialog+ open={isRemoveTotpOpen}+ onOpenChange={(open) => !isRemovingTotp && setIsRemoveTotpOpen(open)}+ ><AlertDialogContent><AlertDialogHeader><AlertDialogTitle>Remove authenticator app?</AlertDialogTitle>@@ -153,17 +153,20 @@ export const MfaMethodsCard = () => {</AlertDialogDescription></AlertDialogHeader><AlertDialogFooter>- <AlertDialogCancel>Cancel</AlertDialogCancel>+ <AlertDialogCancel isDisabled={isRemovingTotp}>Cancel</AlertDialogCancel><AlertDialogActionvariant="danger"isPending={isRemovingTotp}- onClick={handleRemoveTotp}+ onClick={(event) => {+ event.preventDefault();+ handleRemoveTotp();+ }}>Remove</AlertDialogAction></AlertDialogFooter></AlertDialogContent></AlertDialog>- </div>+ </section>);};diff --git a/frontend/src/pages/user/PersonalSettingsPage/components/SecuritySection/PasskeyManagerDialog.tsx b/frontend/src/pages/user/PersonalSettingsPage/components/SecuritySection/PasskeyManagerDialog.tsxindex b149e983bb..dd675b64b9 100644--- a/frontend/src/pages/user/PersonalSettingsPage/components/SecuritySection/PasskeyManagerDialog.tsx+++ b/frontend/src/pages/user/PersonalSettingsPage/components/SecuritySection/PasskeyManagerDialog.tsx@@ -1,7 +1,6 @@import { useState } from "react";import { FingerprintIcon, PlusIcon, TrashIcon, TriangleAlertIcon } from "lucide-react";-import { ContentLoader } from "@app/components/v2";import {Alert,AlertDescription,@@ -15,12 +14,15 @@ import {AlertDialogTitle,AlertTitle,Button,+ Field,+ FieldLabel,Input,Sheet,SheetContent,SheetDescription,SheetHeader,- SheetTitle+ SheetTitle,+ Skeleton} from "@app/components/v3";import { useGetWebAuthnCredentials, useRegisterPasskey } from "@app/hooks/api/webauthn";@@ -32,7 +34,7 @@ type Props = {};export const PasskeyManagerDialog = ({ isOpen, onOpenChange }: Props) => {- const { data, isPending } = useGetWebAuthnCredentials();+ const { data, isPending, isError, refetch } = useGetWebAuthnCredentials();const credentials = data?.credentials ?? [];const { registerPasskey, isRegistering } = useRegisterPasskey();const { removePasskey, isBusy: isRemoving } = useRemovePasskey();@@ -84,15 +86,17 @@ export const PasskeyManagerDialog = ({ isOpen, onOpenChange }: Props) => {</SheetHeader><div className="flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto p-4">- <div className="flex items-end gap-2">- <div className="flex-1">+ <div className="flex flex-col items-stretch gap-2 sm:flex-row sm:items-end">+ <Field className="flex-1">+ <FieldLabel htmlFor="new-passkey-name">Passkey name</FieldLabel><Input+ id="new-passkey-name"value={name}onChange={(e) => setName(e.target.value)}placeholder="New passkey name (optional)"/>- </div>- <Button variant="org" isPending={isRegistering} onClick={handleAdd}>+ </Field>+ <Button variant="neutral" isPending={isRegistering} onClick={handleAdd}><PlusIcon /> Add</Button></div>@@ -111,9 +115,24 @@ export const PasskeyManagerDialog = ({ isOpen, onOpenChange }: Props) => {</Alert>)}- {isPending ? (- <ContentLoader />- ) : (+ {isPending && (+ <div className="flex flex-col gap-2" aria-label="Loading passkeys">+ <Skeleton className="h-16 w-full" />+ <Skeleton className="h-16 w-full" />+ </div>+ )}+ {!isPending && isError && (+ <Alert variant="danger">+ <TriangleAlertIcon />+ <AlertTitle>Passkeys could not be loaded</AlertTitle>+ <AlertDescription>+ <Button size="sm" variant="outline" onClick={() => refetch()}>+ Retry+ </Button>+ </AlertDescription>+ </Alert>+ )}+ {!isPending && !isError && (<div className="flex flex-col gap-2">{credentials.length === 0 && (<p className="rounded-lg border border-border bg-container p-4 text-center text-sm text-muted">@@ -123,12 +142,12 @@ export const PasskeyManagerDialog = ({ isOpen, onOpenChange }: Props) => {{credentials.map((credential) => (<divkey={credential.id}- className="flex items-center justify-between rounded-lg border border-border bg-container p-3"+ className="flex flex-col items-stretch justify-between gap-3 rounded-lg border border-border bg-container p-3 sm:flex-row sm:items-center">- <div className="flex items-center gap-3">+ <div className="flex min-w-0 items-center gap-3"><FingerprintIcon className="text-muted" />- <div>- <p className="text-sm text-foreground">+ <div className="min-w-0">+ <p className="truncate text-sm text-foreground">{credential.name || "Unnamed passkey"}</p><p className="text-xs text-muted">@@ -141,6 +160,7 @@ export const PasskeyManagerDialog = ({ isOpen, onOpenChange }: Props) => {<Buttonvariant="danger"size="sm"+ className="self-end sm:self-auto"onClick={() =>setCredentialToRemove({id: credential.id,@@ -160,7 +180,7 @@ export const PasskeyManagerDialog = ({ isOpen, onOpenChange }: Props) => {<AlertDialogopen={credentialToRemove !== null}- onOpenChange={(open) => !open && setCredentialToRemove(null)}+ onOpenChange={(open) => !open && !isRemoving && setCredentialToRemove(null)}><AlertDialogContent><AlertDialogHeader>@@ -170,8 +190,15 @@ export const PasskeyManagerDialog = ({ isOpen, onOpenChange }: Props) => {</AlertDialogDescription></AlertDialogHeader><AlertDialogFooter>- <AlertDialogCancel>Cancel</AlertDialogCancel>- <AlertDialogAction variant="danger" isPending={isRemoving} onClick={handleDelete}>+ <AlertDialogCancel isDisabled={isRemoving}>Cancel</AlertDialogCancel>+ <AlertDialogAction+ variant="danger"+ isPending={isRemoving}+ onClick={(event) => {+ event.preventDefault();+ handleDelete();+ }}+ >Remove</AlertDialogAction></AlertDialogFooter>diff --git a/frontend/src/pages/user/PersonalSettingsPage/components/SecuritySection/RecoveryOptionsCard.tsx b/frontend/src/pages/user/PersonalSettingsPage/components/SecuritySection/RecoveryOptionsCard.tsxindex 0c0a7643b3..d52d02d52c 100644--- a/frontend/src/pages/user/PersonalSettingsPage/components/SecuritySection/RecoveryOptionsCard.tsx+++ b/frontend/src/pages/user/PersonalSettingsPage/components/SecuritySection/RecoveryOptionsCard.tsx@@ -12,11 +12,13 @@ import {AlertDialogHeader,AlertDialogTitle,Button,+ CardHeader,Dialog,DialogContent,DialogDescription,DialogHeader,- DialogTitle+ DialogTitle,+ Separator} from "@app/components/v3";import { useRecoveryCodesMfa } from "./useRecoveryCodesMfa";@@ -46,20 +48,23 @@ export const RecoveryOptionsCard = () => {};return (- <div className="p-6">- <h3 className="mb-4 text-sm font-medium text-foreground">Recovery options</h3>- <div className="flex items-center justify-between gap-4">- <div className="flex items-start gap-3">- <KeyRoundIcon className="mt-0.5 text-muted" />- <div>- <p className="text-sm text-foreground">Recovery codes</p>- <p className="text-xs text-muted">- Recovery codes let you sign in if you lose access to your other methods. Each code- works once.- </p>- </div>+ <section className="grid gap-4" aria-labelledby="recovery-options-title">+ <CardHeader>+ <div className="flex items-center gap-4">+ <h3 id="recovery-options-title" className="shrink-0 font-alliance text-sm font-semibold">+ Recovery options+ </h3>+ <Separator className="flex-1" /></div>- <div className="flex shrink-0 items-center gap-2">+ </CardHeader>+ <div className="grid grid-cols-[1.5rem_minmax(0,1fr)] items-start gap-x-3 gap-y-0.5 py-3 sm:grid-cols-[1.5rem_minmax(0,1fr)_auto]">+ <KeyRoundIcon className="row-span-2 row-start-1 size-6 text-muted" />+ <p className="col-start-2 row-start-1 text-sm text-foreground">Recovery codes</p>+ <p className="col-start-2 row-start-2 text-sm text-muted">+ Recovery codes let you sign in if you lose access to your other methods. Each code works+ once.+ </p>+ <div className="col-start-2 row-start-3 flex flex-wrap items-center gap-2 justify-self-end sm:col-start-3 sm:row-span-2 sm:row-start-1 sm:self-center"><Button variant="outline" size="sm" isDisabled={isBusy} onClick={viewCodes}><EyeIcon /> View</Button>@@ -97,7 +102,7 @@ export const RecoveryOptionsCard = () => {Store these somewhere safe. Each code can only be used once.</DialogDescription></DialogHeader>- <div className="max-h-[50vh] overflow-y-auto">+ <div className="max-h-80 overflow-y-auto"><RecoveryCodesViewrecoveryCodes={codes ?? []}acknowledgment={@@ -132,6 +137,6 @@ export const RecoveryOptionsCard = () => {</AlertDialogFooter></AlertDialogContent></AlertDialog>- </div>+ </section>);};diff --git a/frontend/src/pages/user/PersonalSettingsPage/components/SessionsSection/SessionsSection.tsx b/frontend/src/pages/user/PersonalSettingsPage/components/SessionsSection/SessionsSection.tsxindex 08cf20df89..4802199dff 100644--- a/frontend/src/pages/user/PersonalSettingsPage/components/SessionsSection/SessionsSection.tsx+++ b/frontend/src/pages/user/PersonalSettingsPage/components/SessionsSection/SessionsSection.tsx@@ -1,41 +1,85 @@-import { faBan } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";+import { useState } from "react";-import { Button } from "@app/components/v2";+import {+ AlertDialog,+ AlertDialogAction,+ AlertDialogCancel,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogHeader,+ AlertDialogTitle,+ Button,+ Card,+ CardContent,+ CardDescription,+ CardFooter,+ CardHeader,+ CardTitle+} from "@app/components/v3";import { useRevokeMySessions } from "@app/hooks/api";import { SessionsTable } from "./SessionsTable";export const SessionsSection = () => {- const { mutateAsync } = useRevokeMySessions();+ const [isRevokeAllOpen, setIsRevokeAllOpen] = useState(false);+ const { mutateAsync, isPending } = useRevokeMySessions();const onRevokeAllSessionsClick = async () => {try {await mutateAsync();+ setIsRevokeAllOpen(false);window.location.href = "/login";- } catch (err) {- console.error(err);+ } catch {+ // MutationCache.onError handles the error notification.}};return (- <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">- <div className="mb-8 flex justify-between">- <h2 className="flex-1 text-xl font-medium text-mineshaft-100">Sessions</h2>- <Button- colorSchema="secondary"- type="submit"- leftIcon={<FontAwesomeIcon icon={faBan} />}- onClick={onRevokeAllSessionsClick}- >- Revoke all- </Button>- </div>- <p className="mb-8 text-gray-400">- Logging into Infisical via browser or CLI creates a session. Revoking all sessions logs your- account out all active sessions across all browsers and CLIs.- </p>- <SessionsTable />- </div>+ <>+ <Card className="gap-0 overflow-hidden p-0">+ <CardHeader className="p-6">+ <CardTitle className="font-alliance">Sessions</CardTitle>+ <CardDescription>+ Review browser and CLI sessions with access to your account.+ </CardDescription>+ </CardHeader>+ <CardContent className="px-6 pb-6">+ <SessionsTable />+ </CardContent>+ <CardFooter className="min-h-8 justify-end border-t border-neutral/15 bg-neutral/5 p-4">+ <Button variant="neutral" size="sm" onClick={() => setIsRevokeAllOpen(true)}>+ Sign out everywhere+ </Button>+ </CardFooter>+ </Card>++ <AlertDialog+ open={isRevokeAllOpen}+ onOpenChange={(open) => !isPending && setIsRevokeAllOpen(open)}+ >+ <AlertDialogContent>+ <AlertDialogHeader>+ <AlertDialogTitle>Sign out everywhere?</AlertDialogTitle>+ <AlertDialogDescription>+ This signs your account out of every browser and CLI, including this session. You will+ need to sign in again.+ </AlertDialogDescription>+ </AlertDialogHeader>+ <AlertDialogFooter>+ <AlertDialogCancel isDisabled={isPending}>Cancel</AlertDialogCancel>+ <AlertDialogAction+ isPending={isPending}+ onClick={(event) => {+ event.preventDefault();+ onRevokeAllSessionsClick();+ }}+ >+ Sign out everywhere+ </AlertDialogAction>+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog>+ </>);};diff --git a/frontend/src/pages/user/PersonalSettingsPage/components/SessionsSection/SessionsTable.tsx b/frontend/src/pages/user/PersonalSettingsPage/components/SessionsSection/SessionsTable.tsxindex f37be42a1d..c204e6a7e6 100644--- a/frontend/src/pages/user/PersonalSettingsPage/components/SessionsSection/SessionsTable.tsx+++ b/frontend/src/pages/user/PersonalSettingsPage/components/SessionsSection/SessionsTable.tsx@@ -1,22 +1,37 @@-import { faServer } from "@fortawesome/free-solid-svg-icons";+import { useState } from "react";+import { AlertCircleIcon, ServerIcon } from "lucide-react";import { createNotification } from "@app/components/notifications";import {- DeleteActionModal,- EmptyState,+ Alert,+ AlertDescription,+ AlertDialog,+ AlertDialogAction,+ AlertDialogCancel,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogHeader,+ AlertDialogTitle,+ AlertTitle,+ Button,+ Empty,+ EmptyDescription,+ EmptyHeader,+ EmptyMedia,+ EmptyTitle,+ Skeleton,Table,- TableContainer,- TableSkeleton,- TBody,- Td,- Th,- THead,+ TableBody,+ TableCell,+ TableHead,+ TableHeader,+ TableRow,Tooltip,- Tr-} from "@app/components/v2";-import { Button } from "@app/components/v2/Button";+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import { useGetMySessions, useRevokeMySessionById } from "@app/hooks/api";-import { usePopUp } from "@app/hooks/usePopUp";import { timeAgo } from "@app/lib/fn/date";import { formatSessionUserAgent } from "@app/lib/fn/string";@@ -33,101 +48,187 @@ const formatLocalDateTime = (date: Date): string => {};export const SessionsTable = () => {- const { data, isPending } = useGetMySessions();- const { mutateAsync: revokeMySessionById } = useRevokeMySessionById();- const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([- "deleteSession"- ] as const);+ const { data, isPending, isError, refetch } = useGetMySessions();+ const { mutateAsync: revokeMySessionById, isPending: isRevoking } = useRevokeMySessionById();+ const [sessionToRevoke, setSessionToRevoke] = useState<{+ id: string;+ ip: string;+ browser: string;+ } | null>(null);const handleSignOut = async (sessionId: string) => {- await revokeMySessionById(sessionId);- createNotification({- text: "Session revoked successfully",- type: "success"- });-- handlePopUpClose("deleteSession");+ try {+ await revokeMySessionById(sessionId);+ createNotification({+ text: "Session signed out.",+ type: "success"+ });+ setSessionToRevoke(null);+ } catch {+ createNotification({+ text: "Failed to sign out session.",+ type: "error"+ });+ }};+ if (isError) {+ return (+ <Alert variant="danger">+ <AlertCircleIcon />+ <AlertTitle>Sessions could not be loaded</AlertTitle>+ <AlertDescription>+ <p>Check your connection and try again.</p>+ <Button variant="outline" size="sm" onClick={() => refetch()}>+ Retry+ </Button>+ </AlertDescription>+ </Alert>+ );+ }++ if (!isPending && data?.length === 0) {+ return (+ <Empty className="border">+ <EmptyHeader>+ <EmptyMedia variant="icon">+ <ServerIcon />+ </EmptyMedia>+ <EmptyTitle>No active sessions</EmptyTitle>+ <EmptyDescription>+ Browser and CLI sessions will appear here after you sign in.+ </EmptyDescription>+ </EmptyHeader>+ </Empty>+ );+ }+return (<>- <DeleteActionModal- isOpen={popUp.deleteSession.isOpen}- title="Are you sure you want to sign out of this session?"- onChange={(isOpen) => handlePopUpToggle("deleteSession", isOpen)}- deleteKey="confirm"- onDeleteApproved={() =>- handleSignOut((popUp?.deleteSession?.data as { sessionId: string })?.sessionId)- }- />- <TableContainer className="mt-4">- <Table>- <THead>- <Tr>- <Th>IP & Session ID</Th>- <Th>OS & Browser</Th>- <Th>Last accessed</Th>- <Th>Manage</Th>- </Tr>- </THead>- <TBody>- {isPending && <TableSkeleton columns={4} innerKey="sessions" />}- {!isPending &&- data &&- data.length > 0 &&- data.map(({ id, createdAt, lastUsed, ip, userAgent }) => {- const { os, browser } = formatSessionUserAgent(userAgent);- const lastUsedDate = new Date(lastUsed);- const createdAtDate = new Date(createdAt);+ <Table>+ <TableHeader>+ <TableRow>+ <TableHead>IP and session ID</TableHead>+ <TableHead>Device</TableHead>+ <TableHead>Last accessed</TableHead>+ <TableHead className="w-px">+ <span className="sr-only">Actions</span>+ </TableHead>+ </TableRow>+ </TableHeader>+ <TableBody>+ {isPending &&+ Array.from({ length: 3 }).map((_, index) => (+ <TableRow key={`session-skeleton-${index + 1}`}>+ {Array.from({ length: 4 }).map((__, cellIndex) => (+ <TableCell key={`session-skeleton-cell-${cellIndex + 1}`}>+ <Skeleton className="h-4 w-full max-w-36" />+ </TableCell>+ ))}+ </TableRow>+ ))}+ {data?.map(({ id, createdAt, lastUsed, ip, userAgent }) => {+ const { os, browser } = formatSessionUserAgent(userAgent);+ const lastUsedDate = new Date(lastUsed);+ const createdAtDate = new Date(createdAt);- return (- <Tr className="h-20" key={`session-${id}`}>- <Td>- <div className="flex flex-col">- <span className="font-medium">{ip}</span>- <span className="text-sm text-gray-500">ID: {id}</span>- </div>- </Td>- <Td>- <div className="flex flex-col">- <span className="font-medium">{os}</span>- <span className="text-sm text-gray-500">{browser}</span>- </div>- </Td>- <Td>- <div className="flex flex-col">- <Tooltip content={formatLocalDateTime(lastUsedDate)}>- <span className="font-medium">{timeAgo(lastUsedDate, new Date())}</span>- </Tooltip>- <Tooltip content={formatLocalDateTime(createdAtDate)}>- <span className="text-sm text-gray-500">+ return (+ <TableRow key={`session-${id}`}>+ <TableCell className="h-auto py-2">+ <div className="flex min-w-44 flex-col">+ <span className="text-sm leading-5 font-medium">{ip || "Unknown IP"}</span>+ <span+ className="max-w-64 truncate font-mono text-xs leading-4 text-muted"+ title={id}+ >+ {id}+ </span>+ </div>+ </TableCell>+ <TableCell className="h-auto py-2">+ <div className="flex flex-col">+ <span className="text-sm leading-5 font-medium">+ {os || "Unknown operating system"}+ </span>+ <span className="text-xs leading-4 text-muted">+ {browser || "Unknown browser"}+ </span>+ </div>+ </TableCell>+ <TableCell className="h-auto py-2">+ <div className="flex flex-col">+ <Tooltip>+ <TooltipTrigger asChild>+ <button+ type="button"+ className="w-fit cursor-help rounded-sm bg-transparent p-0 text-left text-sm leading-5 font-medium focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none"+ >+ <time dateTime={lastUsedDate.toISOString()}>+ {timeAgo(lastUsedDate, new Date())}+ </time>+ </button>+ </TooltipTrigger>+ <TooltipContent>{formatLocalDateTime(lastUsedDate)}</TooltipContent>+ </Tooltip>+ <Tooltip>+ <TooltipTrigger asChild>+ <button+ type="button"+ className="w-fit cursor-help rounded-sm bg-transparent p-0 text-left text-xs leading-4 text-muted focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none"+ >+ <time dateTime={createdAtDate.toISOString()}>Created {timeAgo(createdAtDate, new Date())}- </span>- </Tooltip>- </div>- </Td>- <Td>- <Button- variant="plain"- colorSchema="danger"- onClick={() => handlePopUpOpen("deleteSession", { sessionId: id })}- >- Sign out- </Button>- </Td>- </Tr>- );- })}- {!isPending && data && data?.length === 0 && (- <Tr>- <Td colSpan={4}>- <EmptyState title="No sessions on file" icon={faServer} />- </Td>- </Tr>- )}- </TBody>- </Table>- </TableContainer>+ </time>+ </button>+ </TooltipTrigger>+ <TooltipContent>{formatLocalDateTime(createdAtDate)}</TooltipContent>+ </Tooltip>+ </div>+ </TableCell>+ <TableCell className="h-auto py-2 text-right">+ <Button+ variant="outline"+ size="xs"+ onClick={() => setSessionToRevoke({ id, ip, browser })}+ >+ Sign out+ </Button>+ </TableCell>+ </TableRow>+ );+ })}+ </TableBody>+ </Table>++ <AlertDialog+ open={sessionToRevoke !== null}+ onOpenChange={(open) => !open && !isRevoking && setSessionToRevoke(null)}+ >+ <AlertDialogContent>+ <AlertDialogHeader>+ <AlertDialogTitle>Sign out this session?</AlertDialogTitle>+ <AlertDialogDescription>+ {sessionToRevoke+ ? `The ${sessionToRevoke.browser || "unknown browser"} session from ${+ sessionToRevoke.ip || "an unknown IP"+ } will lose access to your account.`+ : "This session will lose access to your account."}+ </AlertDialogDescription>+ </AlertDialogHeader>+ <AlertDialogFooter>+ <AlertDialogCancel isDisabled={isRevoking}>Cancel</AlertDialogCancel>+ <AlertDialogAction+ isPending={isRevoking}+ onClick={(event) => {+ event.preventDefault();+ if (sessionToRevoke) handleSignOut(sessionToRevoke.id);+ }}+ >+ Sign out+ </AlertDialogAction>+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog></>);};diff --git a/frontend/src/pages/user/PersonalSettingsPage/components/UserNameSection/UserNameSection.tsx b/frontend/src/pages/user/PersonalSettingsPage/components/UserNameSection/UserNameSection.tsxindex 5041cf14e1..7701148b38 100644--- a/frontend/src/pages/user/PersonalSettingsPage/components/UserNameSection/UserNameSection.tsx+++ b/frontend/src/pages/user/PersonalSettingsPage/components/UserNameSection/UserNameSection.tsx@@ -4,12 +4,24 @@ import { zodResolver } from "@hookform/resolvers/zod";import { z } from "zod";import { createNotification } from "@app/components/notifications";-import { Button, FormControl, Input } from "@app/components/v2";+import {+ Button,+ Card,+ CardContent,+ CardDescription,+ CardFooter,+ CardHeader,+ CardTitle,+ Field,+ FieldError,+ FieldLabel,+ Input+} from "@app/components/v3";import { useUser } from "@app/context";import { useRenameUser } from "@app/hooks/api/users/queries";const formSchema = z.object({- name: z.string().describe("User Name")+ name: z.string().trim().min(1, "Enter your name.")});type FormData = z.infer<typeof formSchema>;@@ -17,7 +29,12 @@ type FormData = z.infer<typeof formSchema>;export const UserNameSection = (): JSX.Element => {const { user } = useUser();- const { handleSubmit, control, reset } = useForm<FormData>({ resolver: zodResolver(formSchema) });+ const {+ handleSubmit,+ control,+ reset,+ formState: { isDirty }+ } = useForm<FormData>({ resolver: zodResolver(formSchema) });const { mutateAsync, isPending } = useRenameUser();useEffect(() => {@@ -28,39 +45,54 @@ export const UserNameSection = (): JSX.Element => {const onFormSubmit = async ({ name }: FormData) => {if (!user?.id) return;- if (name === "") return;-- await mutateAsync({ newName: name });- createNotification({- text: "Successfully renamed user",- type: "success"- });+ try {+ await mutateAsync({ newName: name });+ reset({ name });+ createNotification({+ text: "Name updated.",+ type: "success"+ });+ } catch {+ createNotification({+ text: "Failed to update name.",+ type: "error"+ });+ }};return (- <form- onSubmit={handleSubmit(onFormSubmit)}- className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4"- >- <p className="mb-4 text-xl font-medium text-mineshaft-100">Name</p>- <div className="mb-2 max-w-md">- <Controller- defaultValue=""- render={({ field, fieldState: { error } }) => (- <FormControl isError={Boolean(error)} errorText={error?.message}>- <Input- placeholder={[user?.firstName, user?.lastName].filter(Boolean).join(" ")}- {...field}- />- </FormControl>- )}- control={control}- name="name"- />- </div>- <Button isLoading={isPending} colorSchema="primary" variant="outline_bg" type="submit">- Save- </Button>+ <form onSubmit={handleSubmit(onFormSubmit)}>+ <Card className="gap-0 overflow-hidden p-0">+ <CardHeader className="p-6">+ <CardTitle className="font-alliance">Profile</CardTitle>+ <CardDescription>Update the name shown across Infisical.</CardDescription>+ </CardHeader>+ <CardContent className="max-w-md px-6 pb-6">+ <Controller+ defaultValue=""+ render={({ field, fieldState: { error } }) => (+ <Field data-invalid={Boolean(error)}>+ <FieldLabel htmlFor="personal-settings-name">Name</FieldLabel>+ <Input id="personal-settings-name" aria-invalid={Boolean(error)} {...field} />+ <FieldError errors={[error]} />+ </Field>+ )}+ control={control}+ name="name"+ />+ </CardContent>+ <CardFooter className="min-h-8 justify-end border-t border-neutral/15 bg-neutral/5 p-4">+ <Button+ variant="neutral"+ size="sm"+ type="submit"+ isPending={isPending}+ isDisabled={!isDirty}+ >+ Save changes+ </Button>+ </CardFooter>+ </Card></form>);};diff --git a/frontend/src/pages/user/PersonalSettingsPage/route.tsx b/frontend/src/pages/user/PersonalSettingsPage/route.tsxindex 080cbf264d..b4316901e9 100644--- a/frontend/src/pages/user/PersonalSettingsPage/route.tsx+++ b/frontend/src/pages/user/PersonalSettingsPage/route.tsx@@ -1,7 +1,14 @@import { createFileRoute } from "@tanstack/react-router";+import { zodValidator } from "@tanstack/zod-adapter";+import { z } from "zod";import { PersonalSettingsPage } from "./PersonalSettingsPage";+export const personalSettingsSearchSchema = z.object({+ selectedTab: z.enum(["general", "authentication", "api-keys"]).catch("general")+});+export const Route = createFileRoute("/_authenticate/personal-settings/_layout/")({- component: PersonalSettingsPage+ component: PersonalSettingsPage,+ validateSearch: zodValidator(personalSettingsSearchSchema)});