Skip to content

Commit 4122b37

Browse files
authored
Merge pull request #2250 from Dokploy/feat/add-name-field-to-profile
feat(profile): add optional name field to user profile form and schema
2 parents b95dfed + 79e9593 commit 4122b37

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

apps/dokploy/components/dashboard/settings/profile/profile-form.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const profileSchema = z.object({
3636
password: z.string().nullable(),
3737
currentPassword: z.string().nullable(),
3838
image: z.string().optional(),
39+
name: z.string().optional(),
3940
allowImpersonation: z.boolean().optional().default(false),
4041
});
4142

@@ -84,6 +85,7 @@ export const ProfileForm = () => {
8485
image: data?.user?.image || "",
8586
currentPassword: "",
8687
allowImpersonation: data?.user?.allowImpersonation || false,
88+
name: data?.user?.name || "",
8789
},
8890
resolver: zodResolver(profileSchema),
8991
});
@@ -97,6 +99,7 @@ export const ProfileForm = () => {
9799
image: data?.user?.image || "",
98100
currentPassword: form.getValues("currentPassword") || "",
99101
allowImpersonation: data?.user?.allowImpersonation,
102+
name: data?.user?.name || "",
100103
},
101104
{
102105
keepValues: true,
@@ -119,6 +122,7 @@ export const ProfileForm = () => {
119122
image: values.image,
120123
currentPassword: values.currentPassword || undefined,
121124
allowImpersonation: values.allowImpersonation,
125+
name: values.name || undefined,
122126
})
123127
.then(async () => {
124128
await refetch();
@@ -128,6 +132,7 @@ export const ProfileForm = () => {
128132
password: "",
129133
image: values.image,
130134
currentPassword: "",
135+
name: values.name || "",
131136
});
132137
})
133138
.catch(() => {
@@ -167,6 +172,19 @@ export const ProfileForm = () => {
167172
className="grid gap-4"
168173
>
169174
<div className="space-y-4">
175+
<FormField
176+
control={form.control}
177+
name="name"
178+
render={({ field }) => (
179+
<FormItem>
180+
<FormLabel>Name</FormLabel>
181+
<FormControl>
182+
<Input placeholder="Name" {...field} />
183+
</FormControl>
184+
<FormMessage />
185+
</FormItem>
186+
)}
187+
/>
170188
<FormField
171189
control={form.control}
172190
name="email"

packages/server/src/db/schema/user.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ export const apiUpdateWebServerMonitoring = z.object({
323323
export const apiUpdateUser = createSchema.partial().extend({
324324
password: z.string().optional(),
325325
currentPassword: z.string().optional(),
326+
name: z.string().optional(),
326327
metricsConfig: z
327328
.object({
328329
server: z.object({

0 commit comments

Comments
 (0)