Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Disable email update

Kiran K7aebe598a879
diff --git a/apps/web/app/api/user/route.ts b/apps/web/app/api/user/route.ts
index 7be71c4bc0..61403c4a5c 100644
--- a/apps/web/app/api/user/route.ts
+++ b/apps/web/app/api/user/route.ts
@@ -10,7 +10,6 @@ import { z } from "zod";
const updateUserSchema = z.object({
name: z.preprocess(trim, z.string().min(1).max(64)).optional(),
- email: z.preprocess(trim, z.string().email()).optional(),
image: z.string().url().optional(),
source: z.preprocess(trim, z.string().min(1).max(32)).optional(),
defaultWorkspace: z.preprocess(trim, z.string().min(1)).optional(),
@@ -58,7 +57,7 @@ export const GET = withSession(async ({ session }) => {
// PATCH /api/user – edit a specific user
export const PATCH = withSession(async ({ req, session }) => {
- let { name, email, image, source, defaultWorkspace } =
+ let { name, image, source, defaultWorkspace } =
await updateUserSchema.parseAsync(await req.json());
if (image) {
@@ -97,7 +96,6 @@ export const PATCH = withSession(async ({ req, session }) => {
},
data: {
...(name && { name }),
- ...(email && { email }),
...(image && { image }),
...(source && { source }),
...(defaultWorkspace && { defaultWorkspace }),
diff --git a/apps/web/app/app.dub.co/(dashboard)/account/settings/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/account/settings/page-client.tsx
index f444f61eca..f562102896 100644
--- a/apps/web/app/app.dub.co/(dashboard)/account/settings/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/account/settings/page-client.tsx
@@ -52,25 +52,13 @@ export default function SettingsPageClient() {
type: "email",
defaultValue: session?.user?.email || undefined,
placeholder: "[email protected]",
+ readOnly: true,
}}
helpText={<UpdateSubscription />}
- handleSubmit={(data) =>
- fetch("/api/user", {
- method: "PATCH",
- headers: {
- "Content-Type": "application/json",
- },
- body: JSON.stringify(data),
- }).then(async (res) => {
- if (res.status === 200) {
- update();
- toast.success("Successfully updated your email!");
- } else {
- const { error } = await res.json();
- toast.error(error.message);
- }
- })
- }
+ handleSubmit={(data) => {
+ return Promise.resolve();
+ }}
+ disabledTooltip="You can't update your email. Please contact support if you need to change it."
/>
<UploadAvatar />
<UserId />