Skip to content

Commit fa8e0d2

Browse files
committed
properly handle emails for github app auth case
1 parent 5b09757 commit fa8e0d2

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

packages/web/src/app/[domain]/components/settingsDropdown.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,24 @@ export const SettingsDropdown = ({
7373
<Settings className="h-4 w-4" />
7474
</Button>
7575
</DropdownMenuTrigger>
76-
<DropdownMenuContent className="w-64">
76+
<DropdownMenuContent className="w-64" align="end" sideOffset={5}>
7777
{session?.user ? (
7878
<DropdownMenuGroup>
79-
<div className="flex flex-row items-start gap-3 p-2">
80-
<Avatar className="flex-shrink-0">
79+
<div className="flex flex-row items-center gap-3 px-3 py-3">
80+
<Avatar className="h-10 w-10 flex-shrink-0">
8181
<AvatarImage
8282
src={session.user.image ?? ""}
8383
/>
84-
<AvatarFallback>
85-
{session.user.name && session.user.name.length > 0 ? session.user.name[0] : 'U'}
84+
<AvatarFallback className="bg-primary/10 text-primary font-semibold">
85+
{session.user.name && session.user.name.length > 0 ? session.user.name[0].toUpperCase() : 'U'}
8686
</AvatarFallback>
8787
</Avatar>
88-
<p className="text-sm font-medium break-all flex-1 leading-relaxed">{session.user.email ?? "User"}</p>
88+
<div className="flex flex-col flex-1 min-w-0">
89+
<p className="text-sm font-semibold truncate">{session.user.name ?? "User"}</p>
90+
{session.user.email && (
91+
<p className="text-xs text-muted-foreground truncate">{session.user.email}</p>
92+
)}
93+
</div>
8994
</div>
9095
<DropdownMenuItem
9196
onClick={() => {

packages/web/src/ee/features/sso/sso.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ export const getSSOProviders = (): Provider[] => {
2020
const providers: Provider[] = [];
2121

2222
if (env.AUTH_EE_GITHUB_CLIENT_ID && env.AUTH_EE_GITHUB_CLIENT_SECRET) {
23-
const baseUrl = env.AUTH_EE_GITHUB_BASE_URL ?? "https://github.com";
24-
const apiUrl = env.AUTH_EE_GITHUB_BASE_URL ? `${env.AUTH_EE_GITHUB_BASE_URL}/api/v3` : "https://api.github.com";
2523
providers.push(GitHub({
2624
clientId: env.AUTH_EE_GITHUB_CLIENT_ID,
2725
clientSecret: env.AUTH_EE_GITHUB_CLIENT_SECRET,
26+
enterprise: {
27+
baseUrl: env.AUTH_EE_GITHUB_BASE_URL,
28+
},
2829
authorization: {
29-
url: `${baseUrl}/login/oauth/authorize`,
3030
params: {
3131
scope: [
3232
'read:user',
@@ -41,14 +41,7 @@ export const getSSOProviders = (): Provider[] => {
4141
].join(' '),
4242
},
4343
},
44-
token: {
45-
url: `${baseUrl}/login/oauth/access_token`,
46-
},
47-
userinfo: {
48-
url: `${apiUrl}/user`,
49-
},
5044
}));
51-
}
5245

5346
if (env.AUTH_EE_GITLAB_CLIENT_ID && env.AUTH_EE_GITLAB_CLIENT_SECRET) {
5447
providers.push(Gitlab({

0 commit comments

Comments
 (0)