({
defaultValues: {
- email: data?.email || "",
+ email: data?.user?.email || "",
password: "",
- image: data?.image || "",
+ image: data?.user?.image || "",
currentPassword: "",
},
resolver: zodResolver(profileSchema),
@@ -84,14 +84,14 @@ export const ProfileForm = () => {
useEffect(() => {
if (data) {
form.reset({
- email: data?.email || "",
+ email: data?.user?.email || "",
password: "",
- image: data?.image || "",
+ image: data?.user?.image || "",
currentPassword: "",
});
- if (data.email) {
- generateSHA256Hash(data.email).then((hash) => {
+ if (data.user.email) {
+ generateSHA256Hash(data.user.email).then((hash) => {
setGravatarHash(hash);
});
}
diff --git a/apps/dokploy/components/layouts/user-nav.tsx b/apps/dokploy/components/layouts/user-nav.tsx
index 421ea5f2..d4de2019 100644
--- a/apps/dokploy/components/layouts/user-nav.tsx
+++ b/apps/dokploy/components/layouts/user-nav.tsx
@@ -51,12 +51,15 @@ export const UserNav = () => {
className="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground"
>
-
+
CN
Account
- {data?.email}
+ {data?.user?.email}
@@ -71,7 +74,7 @@ export const UserNav = () => {
My Account
- {data?.email}
+ {data?.user?.email}
diff --git a/apps/dokploy/pages/dashboard/settings/profile.tsx b/apps/dokploy/pages/dashboard/settings/profile.tsx
index 1d6d9896..656c3099 100644
--- a/apps/dokploy/pages/dashboard/settings/profile.tsx
+++ b/apps/dokploy/pages/dashboard/settings/profile.tsx
@@ -19,7 +19,7 @@ const Page = () => {
authId: data?.id || "",
},
{
- enabled: !!data?.id && data?.role === "member",
+ enabled: !!data?.id && data?.role === "user",
},
);
@@ -62,7 +62,7 @@ export async function getServerSideProps(
await helpers.settings.isCloud.prefetch();
await helpers.auth.get.prefetch();
- if (user?.role === "member") {
+ if (user?.role === "user") {
await helpers.user.byAuthId.prefetch({
authId: user.authId,
});
diff --git a/apps/dokploy/server/api/trpc.ts b/apps/dokploy/server/api/trpc.ts
index 4e777883..98b5ab8e 100644
--- a/apps/dokploy/server/api/trpc.ts
+++ b/apps/dokploy/server/api/trpc.ts
@@ -31,7 +31,7 @@ import { ZodError } from "zod";
*/
interface CreateContextOptions {
- user: (User & { rol: "admin" | "user"; ownerId: string }) | null;
+ user: (User & { rol: "member" | "admin" | "owner"; ownerId: string }) | null;
session: (Session & { activeOrganizationId?: string }) | null;
req: CreateNextContextOptions["req"];
res: CreateNextContextOptions["res"];
@@ -91,7 +91,7 @@ export const createTRPCContext = async (opts: CreateNextContextOptions) => {
? {
...user,
email: user.email,
- rol: user.role as "admin" | "user",
+ rol: user.role as "owner" | "member" | "admin",
id: user.id,
ownerId: user.ownerId,
}
@@ -188,7 +188,7 @@ export const uploadProcedure = async (opts: any) => {
};
export const cliProcedure = t.procedure.use(({ ctx, next }) => {
- if (!ctx.session || !ctx.user || ctx.user.rol !== "admin") {
+ if (!ctx.session || !ctx.user || ctx.user.rol !== "owner") {
throw new TRPCError({ code: "UNAUTHORIZED" });
}
return next({
@@ -202,7 +202,7 @@ export const cliProcedure = t.procedure.use(({ ctx, next }) => {
});
export const adminProcedure = t.procedure.use(({ ctx, next }) => {
- if (!ctx.session || !ctx.user || ctx.user.rol !== "admin") {
+ if (!ctx.session || !ctx.user || ctx.user.rol !== "owner") {
throw new TRPCError({ code: "UNAUTHORIZED" });
}
return next({