feat: support oidc picture if available
This commit is contained in:
parent
5f6460f42f
commit
9c8a2c0120
@ -91,8 +91,19 @@ export default function Header(data: Props) {
|
|||||||
<Link href="https://github.com/juanfont/headscale" text="Headscale" />
|
<Link href="https://github.com/juanfont/headscale" text="Headscale" />
|
||||||
{data.user ? (
|
{data.user ? (
|
||||||
<Menu>
|
<Menu>
|
||||||
<Menu.IconButton label="User">
|
<Menu.IconButton
|
||||||
<CircleUser />
|
label="User"
|
||||||
|
className={cn(data.user.picture ? 'p-0' : '')}
|
||||||
|
>
|
||||||
|
{data.user.picture ? (
|
||||||
|
<img
|
||||||
|
src={data.user.picture}
|
||||||
|
alt={data.user.name}
|
||||||
|
className="w-8 h-8 rounded-full"
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<CircleUser />
|
||||||
|
)}
|
||||||
</Menu.IconButton>
|
</Menu.IconButton>
|
||||||
<Menu.Panel
|
<Menu.Panel
|
||||||
onAction={(key) => {
|
onAction={(key) => {
|
||||||
|
|||||||
@ -130,6 +130,7 @@ export async function finishAuthFlow(oidc: OidcConfig, options: FlowOptions) {
|
|||||||
name: getName(user, claims),
|
name: getName(user, claims),
|
||||||
email: user.email ?? claims.email?.toString(),
|
email: user.email ?? claims.email?.toString(),
|
||||||
username: user.preferred_username ?? claims.preferred_username?.toString(),
|
username: user.preferred_username ?? claims.preferred_username?.toString(),
|
||||||
|
picture: user.picture,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -12,6 +12,7 @@ export type SessionData = {
|
|||||||
name: string;
|
name: string;
|
||||||
email?: string;
|
email?: string;
|
||||||
username?: string;
|
username?: string;
|
||||||
|
picture?: string;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user