Skip to content

Commit f98e27d

Browse files
authored
Merge pull request microsoft#333 from derkoe/feat/show-only-enabled-auth
Show only enabled authentication mechanisms
2 parents 47f4aa9 + e5d279e commit f98e27d

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

src/app/page.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ export default async function Home() {
55
await redirectIfAuthenticated();
66
return (
77
<main className="container max-w-lg flex items-center">
8-
<LogIn isDevMode={process.env.NODE_ENV === "development"} />
8+
<LogIn
9+
isDevMode={process.env.NODE_ENV === "development"}
10+
githubEnabled={!!process.env.AUTH_GITHUB_ID}
11+
entraIdEnabled={!!process.env.AZURE_AD_CLIENT_ID}
12+
/>
913
</main>
1014
);
1115
}

src/features/auth-page/login.tsx

+10-4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import {
1414

1515
interface LoginProps {
1616
isDevMode: boolean;
17+
githubEnabled: boolean;
18+
entraIdEnabled: boolean;
1719
}
1820

1921
export const LogIn: FC<LoginProps> = (props) => {
@@ -31,13 +33,17 @@ export const LogIn: FC<LoginProps> = (props) => {
3133
</CardDescription>
3234
</CardHeader>
3335
<CardContent className="grid gap-4">
34-
<Button onClick={() => signIn("github")}>GitHub</Button>
35-
<Button onClick={() => signIn("azure-ad")}> Microsoft 365</Button>
36-
{props.isDevMode ? (
36+
{props.githubEnabled && (
37+
<Button onClick={() => signIn("github")}>GitHub</Button>
38+
)}
39+
{props.entraIdEnabled && (
40+
<Button onClick={() => signIn("azure-ad")}>Microsoft 365</Button>
41+
)}
42+
{props.isDevMode && (
3743
<Button onClick={() => signIn("localdev")}>
3844
Basic Auth (DEV ONLY)
3945
</Button>
40-
) : null}
46+
)}
4147
</CardContent>
4248
</Card>
4349
);

0 commit comments

Comments
 (0)