Skip to content

Commit

Permalink
create prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
peintnermax committed Mar 8, 2024
1 parent 324cd89 commit 4fcbf77
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions apps/login/app/(login)/login/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ export async function GET(request: NextRequest) {
if (authRequestId) {
console.log(`Login with authRequest: ${authRequestId}`);
const { authRequest } = await getAuthRequest(server, { authRequestId });

if (authRequest && authRequest.prompt.includes(Prompt.PROMPT_CREATE)) {
const registerUrl = new URL("/register", request.url);
if (authRequest?.id) {
registerUrl.searchParams.set("authRequestId", authRequest?.id);
}

return NextResponse.redirect(registerUrl);
}
const ids = sessionCookies.map((s) => s.id);

let sessions: Session[] = [];
Expand All @@ -105,6 +114,7 @@ export async function GET(request: NextRequest) {

return NextResponse.redirect(accountsUrl);
} else {
// NONE prompt - silent authentication
// check for loginHint, userId hint sessions
let selectedSession = findSession(sessions, authRequest);

Expand Down

0 comments on commit 4fcbf77

Please sign in to comment.