This commit is contained in:
peintnermax
2024-04-04 11:20:46 +02:00
parent 248b543b02
commit e119d9b433

View File

@@ -6,17 +6,7 @@ export async function POST(request: NextRequest) {
const body = await request.json(); const body = await request.json();
if (body) { if (body) {
const { loginName, authRequestId, organization } = body; const { loginName, authRequestId, organization } = body;
// TODO - search for users with org
console.log(
"loginName",
loginName,
"authRequestId",
authRequestId,
"organization",
organization
);
return listUsers(loginName, organization).then((users) => { return listUsers(loginName, organization).then((users) => {
console.log("users", users);
if ( if (
users.details && users.details &&
users.details.totalResult == 1 && users.details.totalResult == 1 &&
@@ -30,7 +20,6 @@ export async function POST(request: NextRequest) {
authRequestId authRequestId
) )
.then((session) => { .then((session) => {
console.log(session);
if (session.factors?.user?.id) { if (session.factors?.user?.id) {
return listAuthenticationMethodTypes(session.factors?.user?.id) return listAuthenticationMethodTypes(session.factors?.user?.id)
.then((methods) => { .then((methods) => {
@@ -48,6 +37,7 @@ export async function POST(request: NextRequest) {
} }
}) })
.catch((error) => { .catch((error) => {
console.error(error);
return NextResponse.json(error, { status: 500 }); return NextResponse.json(error, { status: 500 });
}); });
} else { } else {