fix no name returned in github

This commit is contained in:
Amruth Pillai
2026-02-02 13:03:49 +01:00
parent 17569d0658
commit 5ec73e9234
3 changed files with 390 additions and 262 deletions
+3 -3
View File
@@ -82,7 +82,7 @@
"input-otp": "^1.4.2", "input-otp": "^1.4.2",
"js-cookie": "^3.0.5", "js-cookie": "^3.0.5",
"monaco-editor": "^0.55.1", "monaco-editor": "^0.55.1",
"motion": "^12.29.2", "motion": "^12.29.3",
"nodemailer": "^7.0.13", "nodemailer": "^7.0.13",
"pg": "^8.18.0", "pg": "^8.18.0",
"puppeteer-core": "^24.36.1", "puppeteer-core": "^24.36.1",
@@ -96,7 +96,7 @@
"react-window": "^2.2.6", "react-window": "^2.2.6",
"react-zoom-pan-pinch": "^3.7.0", "react-zoom-pan-pinch": "^3.7.0",
"reflect-metadata": "^0.2.2", "reflect-metadata": "^0.2.2",
"shadcn": "^3.8.1", "shadcn": "^3.8.2",
"sharp": "^0.34.5", "sharp": "^0.34.5",
"sonner": "^2.0.7", "sonner": "^2.0.7",
"tailwind-merge": "^3.4.0", "tailwind-merge": "^3.4.0",
@@ -125,7 +125,7 @@
"@types/pg": "^8.16.0", "@types/pg": "^8.16.0",
"@types/react": "^19.2.10", "@types/react": "^19.2.10",
"@types/react-dom": "^19.2.3", "@types/react-dom": "^19.2.3",
"@vitejs/plugin-react": "^5.1.2", "@vitejs/plugin-react": "^5.1.3",
"babel-plugin-macros": "^3.1.0", "babel-plugin-macros": "^3.1.0",
"drizzle-kit": "^1.0.0-beta.12-a5629fb", "drizzle-kit": "^1.0.0-beta.12-a5629fb",
"knip": "^5.82.1", "knip": "^5.82.1",
+380 -256
View File
File diff suppressed because it is too large Load Diff
+7 -3
View File
@@ -143,8 +143,10 @@ const getAuthConfig = () => {
// biome-ignore lint/style/noNonNullAssertion: enabled check ensures these are not null // biome-ignore lint/style/noNonNullAssertion: enabled check ensures these are not null
clientSecret: env.GOOGLE_CLIENT_SECRET!, clientSecret: env.GOOGLE_CLIENT_SECRET!,
mapProfileToUser: async (profile) => { mapProfileToUser: async (profile) => {
const name = profile.name ?? profile.email.split("@")[0];
return { return {
name: profile.name, name,
email: profile.email, email: profile.email,
image: profile.picture, image: profile.picture,
username: profile.email.split("@")[0], username: profile.email.split("@")[0],
@@ -162,8 +164,10 @@ const getAuthConfig = () => {
// biome-ignore lint/style/noNonNullAssertion: enabled check ensures these are not null // biome-ignore lint/style/noNonNullAssertion: enabled check ensures these are not null
clientSecret: env.GITHUB_CLIENT_SECRET!, clientSecret: env.GITHUB_CLIENT_SECRET!,
mapProfileToUser: async (profile) => { mapProfileToUser: async (profile) => {
const name = profile.name ?? profile.login ?? String(profile.id);
const login = profile.login ?? String(profile.id); const login = profile.login ?? String(profile.id);
const normalizedLogin = toUsername(login); const normalizedLogin = toUsername(login);
const [legacyAccount] = await db const [legacyAccount] = await db
.select({ .select({
accountId: schema.account.accountId, accountId: schema.account.accountId,
@@ -185,7 +189,7 @@ const getAuthConfig = () => {
if (legacyAccount) { if (legacyAccount) {
return { return {
id: legacyAccount.accountId, id: legacyAccount.accountId,
name: profile.name, name,
email: legacyAccount.email, email: legacyAccount.email,
image: profile.avatar_url, image: profile.avatar_url,
username: legacyAccount.username, username: legacyAccount.username,
@@ -195,7 +199,7 @@ const getAuthConfig = () => {
} }
return { return {
name: profile.name, name,
email: profile.email, email: profile.email,
image: profile.avatar_url, image: profile.avatar_url,
username: normalizedLogin, username: normalizedLogin,