Skip to content

Commit

Permalink
login hint
Browse files Browse the repository at this point in the history
  • Loading branch information
peintnermax committed Dec 9, 2024
1 parent 84c05d8 commit cd53ccb
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions apps/login/src/app/login/route.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { getAllSessions } from "@/lib/cookies";
import { idpTypeToSlug } from "@/lib/idp";
import { sendLoginname } from "@/lib/server/loginname";
import {
createCallback,
getActiveIdentityProviders,
Expand Down Expand Up @@ -241,14 +242,19 @@ export async function GET(request: NextRequest) {
if (authRequest.prompt.includes(Prompt.SELECT_ACCOUNT)) {
return gotoAccounts();
} else if (authRequest.prompt.includes(Prompt.LOGIN)) {
// if prompt is login
// if a hint is provided, skip loginname page and jump to the next page
if (authRequest.loginHint) {
return sendLoginname({
loginName: authRequest.loginHint,
organization,
authRequestId: authRequest.id,
});
}

const loginNameUrl = new URL("/loginname", request.url);
if (authRequest?.id) {
loginNameUrl.searchParams.set("authRequestId", authRequest?.id);
}
if (authRequest.loginHint) {
loginNameUrl.searchParams.set("loginName", authRequest.loginHint);
}
if (organization) {
loginNameUrl.searchParams.set("organization", organization);
}
Expand Down

0 comments on commit cd53ccb

Please sign in to comment.