mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-12 20:22:18 +00:00
pass sessionid on verify, create session for created user
This commit is contained in:
@@ -5,7 +5,8 @@ import { ExclamationTriangleIcon } from "@heroicons/react/24/outline";
|
||||
|
||||
export default async function Page({ searchParams }: { searchParams: any }) {
|
||||
const {
|
||||
userID,
|
||||
userId,
|
||||
sessionId,
|
||||
code,
|
||||
submit,
|
||||
organization,
|
||||
@@ -31,6 +32,7 @@ export default async function Page({ searchParams }: { searchParams: any }) {
|
||||
submit={submit === "true"}
|
||||
organization={organization}
|
||||
authRequestId={authRequestId}
|
||||
sessionId={sessionId}
|
||||
/>
|
||||
) : (
|
||||
<div className="w-full flex flex-row items-center justify-center border border-yellow-600/40 dark:border-yellow-500/20 bg-yellow-200/30 text-yellow-600 dark:bg-yellow-700/20 dark:text-yellow-200 rounded-md py-2 scroll-px-40">
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
import { addHumanUser, server } from "#/lib/zitadel";
|
||||
import {
|
||||
createSessionAndUpdateCookie,
|
||||
createSessionForUserIdAndUpdateCookie,
|
||||
} from "#/utils/session";
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
@@ -20,8 +24,18 @@ export async function POST(request: NextRequest) {
|
||||
password: password ? password : undefined,
|
||||
organization,
|
||||
})
|
||||
.then((userId) => {
|
||||
return NextResponse.json({ userId });
|
||||
.then((user) => {
|
||||
return createSessionForUserIdAndUpdateCookie(
|
||||
user.userId,
|
||||
password,
|
||||
undefined,
|
||||
authRequestId
|
||||
).then((session) => {
|
||||
return NextResponse.json({
|
||||
userId: user.userId,
|
||||
sessionId: session.id,
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
return NextResponse.json(error, { status: 500 });
|
||||
|
||||
Reference in New Issue
Block a user