Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(ui): accept guest email addresses in member forms (#45688)

moyai-devin-berriai[bot]627356d3a0d9
diff --git a/ui/litellm-dashboard/src/components/team/EditMembership.integration.test.tsx b/ui/litellm-dashboard/src/components/team/EditMembership.integration.test.tsx
index d542b19f718..45800a18ff8 100644
--- a/ui/litellm-dashboard/src/components/team/EditMembership.integration.test.tsx
+++ b/ui/litellm-dashboard/src/components/team/EditMembership.integration.test.tsx
@@ -227,15 +227,40 @@ describe("EditMembership submit payload", () => {
expect(submitted().role).toBe("admin");
});
- it("blocks submission when the email is not an address", async () => {
- renderEdit(orgMemberConfig, { user_id: "u1", user_email: "[email protected]", role: "user" });
+ it.each(["john_example.com#EXT#@tenant.onmicrosoft.com", "john#[email protected]"])(
+ "saves budget and limit edits for %s",
+ async (user_email) => {
+ renderEdit(teamMemberConfig, { ...cappedMember, user_email });
+
+ fireEvent.change(screen.getByLabelText("Team Member Budget (USD)"), { target: { value: "25" } });
+ fireEvent.change(screen.getByLabelText("Team Member TPM Limit"), { target: { value: "100" } });
+ fireEvent.change(screen.getByLabelText("Team Member RPM Limit"), { target: { value: "10" } });
+ save();
+
+ await waitFor(() => expect(onSubmit).toHaveBeenCalledOnce());
+ const expectedChanges = {
+ user_id: "u1",
+ user_email,
+ max_budget_in_team: "25",
+ tpm_limit: "100",
+ rpm_limit: "10",
+ };
+ expect(submitted()).toEqual(expect.objectContaining(expectedChanges));
+ },
+ );
- fireEvent.change(screen.getByLabelText("Email"), { target: { value: "not-an-email" } });
- save();
+ it.each(["not-an-email", "john@@example.com", "john [email protected]", "john@example#com"])(
+ "blocks submission for an invalid address: %s",
+ async (user_email) => {
+ renderEdit(orgMemberConfig, { user_id: "u1", user_email: "[email protected]", role: "user" });
- expect(await screen.findByText("Please enter a valid email!")).toBeInTheDocument();
- expect(onSubmit).not.toHaveBeenCalled();
- });
+ fireEvent.change(screen.getByLabelText("Email"), { target: { value: user_email } });
+ save();
+
+ expect(await screen.findByText("Please enter a valid email!")).toBeInTheDocument();
+ expect(onSubmit).not.toHaveBeenCalled();
+ },
+ );
it("blocks submission when no role is selected", async () => {
renderEdit(orgMemberConfig, { user_id: "u1", user_email: "[email protected]", role: "" });
diff --git a/ui/litellm-dashboard/src/components/team/EditMembership.tsx b/ui/litellm-dashboard/src/components/team/EditMembership.tsx
index 3e6cb7d1284..4aaeb42da98 100644
--- a/ui/litellm-dashboard/src/components/team/EditMembership.tsx
+++ b/ui/litellm-dashboard/src/components/team/EditMembership.tsx
@@ -48,7 +48,8 @@ interface MemberModalProps<T extends BaseMember> {
const ROLE_REQUIRED_MESSAGE = "Please select a role!";
-const isEmailish = (value: string): boolean => value === "" || z.email().safeParse(value).success;
+const isEmailish = (value: string): boolean =>
+ value === "" || z.email({ pattern: z.regexes.html5Email }).safeParse(value).success;
const memberFieldSchema = z.union([z.string(), z.number(), z.null(), z.array(z.string())]).optional();