Skip to content

Commit 784b387

Browse files
committed
refactor: update login-related URLs to use /api prefix and standardize paths
1 parent 4504fb9 commit 784b387

9 files changed

Lines changed: 13 additions & 9 deletions

File tree

apps/login/src/app/(login)/accounts/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export default async function Page(props: {
8080

8181
<div className="flex flex-col w-full space-y-2">
8282
<SessionsList sessions={sessions} requestId={requestId} />
83-
<Link href={`/loginname?` + params}>
83+
<Link href={`/login?` + params}>
8484
<div className="flex flex-row items-center py-3 px-4 hover:bg-black/10 dark:hover:bg-white/10 rounded-md transition-all">
8585
<div className="w-8 h-8 mr-4 flex flex-row justify-center items-center rounded-full bg-black/5 dark:bg-white/5">
8686
<UserPlusIcon className="h-5 w-5" />

apps/login/src/app/(login)/device/consent/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export default async function Page(props: {
9191
deviceAuthorizationRequestId={deviceAuthorizationRequest?.id}
9292
scope={deviceAuthorizationRequest.scope}
9393
appName={deviceAuthorizationRequest?.appName}
94-
nextUrl={`/loginname?` + params}
94+
nextUrl={`/login?` + params}
9595
/>
9696
</div>
9797
</DynamicTheme>

apps/login/src/app/(login)/loginname/page.tsx renamed to apps/login/src/app/(login)/login/page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ export default async function Page(props: {
4141
organization: organization ?? defaultOrganization,
4242
});
4343

44+
console.log({ loginSettings });
45+
4446
const contextLoginSettings = await getLoginSettings({
4547
serviceUrl,
4648
organization,

apps/login/src/app/(login)/otp/[method]/set/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export default async function Page(props: {
114114
if (requestId) {
115115
paramsToContinue.append("authRequest", requestId);
116116
}
117-
urlToContinue = `/login?` + paramsToContinue;
117+
urlToContinue = `/api/login?` + paramsToContinue;
118118
} else if (loginName) {
119119
if (requestId) {
120120
paramsToContinue.append("requestId", requestId);

apps/login/src/app/(login)/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ import { redirect } from "next/navigation";
33
export default function Page() {
44
// automatically redirect to loginname
55
if (process.env.DEBUG !== "true") {
6-
redirect("/loginname");
6+
redirect("/login");
77
}
88
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { Session } from "@zitadel/proto/zitadel/session/v2/session_pb";
2727
import { IdentityProviderType } from "@zitadel/proto/zitadel/settings/v2/login_settings_pb";
2828
import { headers } from "next/headers";
2929
import { NextRequest, NextResponse } from "next/server";
30-
import { DEFAULT_CSP } from "../../../constants/csp";
30+
import { DEFAULT_CSP } from "../../../../constants/csp";
3131

3232
export const dynamic = "force-dynamic";
3333
export const revalidate = false;
@@ -296,7 +296,7 @@ export async function GET(request: NextRequest) {
296296
}
297297
}
298298

299-
const loginNameUrl = constructUrl(request, "/loginname");
299+
const loginNameUrl = constructUrl(request, "/login");
300300
if (authRequest.id) {
301301
loginNameUrl.searchParams.set("requestId", `oidc_${authRequest.id}`);
302302
}
@@ -446,7 +446,7 @@ export async function GET(request: NextRequest) {
446446
}
447447
}
448448
} else {
449-
const loginNameUrl = constructUrl(request, "/loginname");
449+
const loginNameUrl = constructUrl(request, "/login");
450450

451451
loginNameUrl.searchParams.set("requestId", requestId);
452452
if (authRequest?.loginHint) {

apps/login/src/lib/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export async function getNextUrl(
6969
params.append("organization", command.organization);
7070
}
7171

72-
return `/login?` + params;
72+
return `/api/login?` + params;
7373
}
7474

7575
if (defaultRedirectUri) {

apps/login/src/middleware.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ export const config = {
1818
async function loadSecuritySettings(
1919
request: NextRequest,
2020
): Promise<SecuritySettings | null> {
21-
const securityResponse = await fetch(`${request.nextUrl.origin}/security`);
21+
const securityResponse = await fetch(
22+
`${request.nextUrl.origin}/api/security`,
23+
);
2224

2325
if (!securityResponse.ok) {
2426
console.error(

0 commit comments

Comments
 (0)