Scheduling infrastructure for absolutely everyone.
fixes 6 character hash suffix in the username for a member of an organization when he sign in via google. (#19633)
Utkarshba4986a333bd
diff --git a/packages/features/auth/lib/next-auth-options.ts b/packages/features/auth/lib/next-auth-options.tsindex 33f0553e6b5..3ff2006da83 100644--- a/packages/features/auth/lib/next-auth-options.ts+++ b/packages/features/auth/lib/next-auth-options.ts@@ -10,6 +10,7 @@ import CredentialsProvider from "next-auth/providers/credentials";import EmailProvider from "next-auth/providers/email";import GoogleProvider from "next-auth/providers/google";+import { updateProfilePhotoGoogle } from "@calcom/app-store/_utils/oauth/updateProfilePhotoGoogle";import GoogleCalendarService from "@calcom/app-store/googlecalendar/lib/CalendarService";import { LicenseKeySingleton } from "@calcom/ee/common/server/LicenseKeyService";@@ -46,6 +47,7 @@ import { dub } from "./dub";import { isPasswordValid } from "./isPasswordValid";import CalComAdapter from "./next-auth-custom-adapter";import { verifyPassword } from "./verifyPassword";+import { getOrgUsernameFromEmail } from "../signup/utils/getOrgUsernameFromEmail"const log = logger.getSubLogger({ prefix: ["next-auth-options"] });const GOOGLE_API_CREDENTIALS = process.env.GOOGLE_API_CREDENTIALS || "{}";@@ -894,7 +896,7 @@ export const getOptions = ({email: user.email,// Slugify the incoming name and append a few random characters to// prevent conflicts for users with the same name.- username: usernameSlug(user.name),+ username: getOrgUsernameFromEmail(user.name,getDomainFromEmail(user.email)),emailVerified: new Date(Date.now()),name: user.name,identityProvider: idP,