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",
"js-cookie": "^3.0.5",
"monaco-editor": "^0.55.1",
"motion": "^12.29.2",
"motion": "^12.29.3",
"nodemailer": "^7.0.13",
"pg": "^8.18.0",
"puppeteer-core": "^24.36.1",
@@ -96,7 +96,7 @@
"react-window": "^2.2.6",
"react-zoom-pan-pinch": "^3.7.0",
"reflect-metadata": "^0.2.2",
"shadcn": "^3.8.1",
"shadcn": "^3.8.2",
"sharp": "^0.34.5",
"sonner": "^2.0.7",
"tailwind-merge": "^3.4.0",
@@ -125,7 +125,7 @@
"@types/pg": "^8.16.0",
"@types/react": "^19.2.10",
"@types/react-dom": "^19.2.3",
"@vitejs/plugin-react": "^5.1.2",
"@vitejs/plugin-react": "^5.1.3",
"babel-plugin-macros": "^3.1.0",
"drizzle-kit": "^1.0.0-beta.12-a5629fb",
"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
clientSecret: env.GOOGLE_CLIENT_SECRET!,
mapProfileToUser: async (profile) => {
const name = profile.name ?? profile.email.split("@")[0];
return {
name: profile.name,
name,
email: profile.email,
image: profile.picture,
username: profile.email.split("@")[0],
@@ -162,8 +164,10 @@ const getAuthConfig = () => {
// biome-ignore lint/style/noNonNullAssertion: enabled check ensures these are not null
clientSecret: env.GITHUB_CLIENT_SECRET!,
mapProfileToUser: async (profile) => {
const name = profile.name ?? profile.login ?? String(profile.id);
const login = profile.login ?? String(profile.id);
const normalizedLogin = toUsername(login);
const [legacyAccount] = await db
.select({
accountId: schema.account.accountId,
@@ -185,7 +189,7 @@ const getAuthConfig = () => {
if (legacyAccount) {
return {
id: legacyAccount.accountId,
name: profile.name,
name,
email: legacyAccount.email,
image: profile.avatar_url,
username: legacyAccount.username,
@@ -195,7 +199,7 @@ const getAuthConfig = () => {
}
return {
name: profile.name,
name,
email: profile.email,
image: profile.avatar_url,
username: normalizedLogin,