diff --git a/apps/dokploy/components/dashboard/settings/profile/profile-form.tsx b/apps/dokploy/components/dashboard/settings/profile/profile-form.tsx
index eaa48a2a6..794291b7d 100644
--- a/apps/dokploy/components/dashboard/settings/profile/profile-form.tsx
+++ b/apps/dokploy/components/dashboard/settings/profile/profile-form.tsx
@@ -268,7 +268,7 @@ export const ProfileForm = () => {
- {getFallbackAvatarInitials(data?.user?.email)}
+ {getFallbackAvatarInitials(data?.user?.name)}
diff --git a/apps/dokploy/components/layouts/user-nav.tsx b/apps/dokploy/components/layouts/user-nav.tsx
index a339f05f4..aa7f4ddd9 100644
--- a/apps/dokploy/components/layouts/user-nav.tsx
+++ b/apps/dokploy/components/layouts/user-nav.tsx
@@ -47,7 +47,7 @@ export const UserNav = () => {
src={data?.user?.image || ""}
alt={data?.user?.image || ""}
/>
- {getFallbackAvatarInitials(data?.user?.email)}
+ {getFallbackAvatarInitials(data?.user?.name)}
Account
diff --git a/apps/dokploy/lib/utils.ts b/apps/dokploy/lib/utils.ts
index cf9f2cc94..dc0dfe351 100644
--- a/apps/dokploy/lib/utils.ts
+++ b/apps/dokploy/lib/utils.ts
@@ -28,14 +28,11 @@ export function formatTimestamp(timestamp: string | number) {
}
}
-export function getFallbackAvatarInitials(email: string | undefined): string {
- if (typeof email === "undefined") return "CN";
-
- const [emailUsername = ""] = email.split('@');
- const parts = emailUsername.split(/[\._-]+/).filter(Boolean);
- if (parts.length >= 2) {
- // @ts-ignore we are sure parts[0] and parts[1] exist
- return (parts[0]?.charAt(0) + parts[1].charAt(0)).toUpperCase();
+export function getFallbackAvatarInitials(fullName: string | undefined): string {
+ if (typeof fullName === "undefined" || fullName === "") return "CN";
+ const [ name = "", surname = "" ] = fullName.split(" ");
+ if (surname === "") {
+ return (name.substring(0,2)).toUpperCase();
}
- return emailUsername.slice(0, 2).toUpperCase();
+ return (name.charAt(0) + surname.charAt(0)).toUpperCase();
}