Skip to content

Commit 6b318ee

Browse files
authored
feat: display user descriptions (#20)
1 parent e4022b2 commit 6b318ee

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"clean": "rm -rf dist/ node_modules/",
2626
"lint": "eslint --max-warnings 0 .",
2727
"lint:format": "prettier --check .",
28-
"start": "pnpm tsup src/index.ts --dts --format cjs,esm --watch",
28+
"start": "pnpm tsup src/index.ts --dts --format cjs,esm --watch --onSuccess 'node dist/index.js'",
2929
"test": "vitest run --coverage",
3030
"test:watch": "vitest",
3131
"typecheck": "tsc --noEmit",

src/config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export type ConfigUser = {
88
username: string;
99
email: string;
1010
name: string;
11+
description?: string;
1112
};
1213

1314
export type Config = {
@@ -39,6 +40,7 @@ export function getConfig(): Config {
3940
username: 'herbert',
4041
email: 'her@bert.de',
4142
name: 'Herbert',
43+
description: 'This is our good old friend Herbert',
4244
},
4345
],
4446
tokenExpiresIn: 24 * 60 * 60, // 24 hours in seconds

src/index.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ server.get(`/auth/realms/${config.realm}/protocol/openid-connect/auth`, async (r
5050
padding: .5rem;
5151
border-radius: .25rem;
5252
}
53+
54+
li > div {
55+
display: flex;
56+
flex-direction: column;
57+
}
5358
</style>
5459
</head>
5560
<body>
@@ -71,7 +76,15 @@ server.get(`/auth/realms/${config.realm}/protocol/openid-connect/auth`, async (r
7176
.map(
7277
(user) =>
7378
`<li>
74-
<a href="/do-login?username=${user.username}&redirect_uri=${query.redirect_uri}">${user.name}</a>
79+
<div>
80+
<div>
81+
<a href="/do-login?username=${user.username}&redirect_uri=${query.redirect_uri}">
82+
${user.name}
83+
</a>
84+
(${user.email})
85+
</div>
86+
${user.description ? `<i>${user.description}</i>` : ''}
87+
</div>
7588
</li>`,
7689
)
7790
.join('')}

0 commit comments

Comments
 (0)