cleanup login prompt

This commit is contained in:
Max Peintner
2024-12-09 11:52:03 +01:00
parent 40e51e11fe
commit c66fc8662e

View File

@@ -1,6 +1,6 @@
import { getAllSessions } from "@/lib/cookies"; import { getAllSessions } from "@/lib/cookies";
import { idpTypeToSlug } from "@/lib/idp"; import { idpTypeToSlug } from "@/lib/idp";
import { sendLoginname } from "@/lib/server/loginname"; import { sendLoginname, SendLoginnameCommand } from "@/lib/server/loginname";
import { import {
createCallback, createCallback,
getActiveIdentityProviders, getActiveIdentityProviders,
@@ -276,11 +276,16 @@ export async function GET(request: NextRequest) {
// if a hint is provided, skip loginname page and jump to the next page // if a hint is provided, skip loginname page and jump to the next page
if (authRequest.loginHint) { if (authRequest.loginHint) {
try { try {
const res = await sendLoginname({ let command: SendLoginnameCommand = {
loginName: authRequest.loginHint, loginName: authRequest.loginHint,
organization,
authRequestId: authRequest.id, authRequestId: authRequest.id,
}); };
if (organization) {
command = { ...command, organization };
}
const res = await sendLoginname(command);
if (res?.redirect) { if (res?.redirect) {
const absoluteUrl = new URL(res.redirect, request.url); const absoluteUrl = new URL(res.redirect, request.url);