mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-13 16:42:34 +00:00
refactor: zitadel server
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
This commit is contained in:
@@ -3,7 +3,6 @@ import {
|
||||
getSession,
|
||||
registerPasskey,
|
||||
registerU2F,
|
||||
server,
|
||||
} from "@/lib/zitadel";
|
||||
import { getSessionCookieById } from "@/utils/cookies";
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
@@ -15,11 +14,7 @@ export async function POST(request: NextRequest) {
|
||||
|
||||
const sessionCookie = await getSessionCookieById(sessionId);
|
||||
|
||||
const session = await getSession(
|
||||
server,
|
||||
sessionCookie.id,
|
||||
sessionCookie.token,
|
||||
);
|
||||
const session = await getSession(sessionCookie.id, sessionCookie.token);
|
||||
|
||||
const domain: string = request.nextUrl.hostname;
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { getSession, server, verifyU2FRegistration } from "@/lib/zitadel";
|
||||
import { getSession, verifyU2FRegistration } from "@/lib/zitadel";
|
||||
import { getSessionCookieById } from "@/utils/cookies";
|
||||
import { VerifyU2FRegistrationRequest } from "@zitadel/server";
|
||||
import { NextRequest, NextResponse, userAgent } from "next/server";
|
||||
import { VerifyU2FRegistrationRequest } from "@zitadel/proto/zitadel/user/v2beta/user_service_pb";
|
||||
import { PlainMessage } from "@zitadel/client2";
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
const body = await request.json();
|
||||
@@ -16,16 +17,12 @@ export async function POST(request: NextRequest) {
|
||||
}
|
||||
const sessionCookie = await getSessionCookieById(sessionId);
|
||||
|
||||
const session = await getSession(
|
||||
server,
|
||||
sessionCookie.id,
|
||||
sessionCookie.token,
|
||||
);
|
||||
const session = await getSession(sessionCookie.id, sessionCookie.token);
|
||||
|
||||
const userId = session?.session?.factors?.user?.id;
|
||||
|
||||
if (userId) {
|
||||
const req: VerifyU2FRegistrationRequest = {
|
||||
const req: PlainMessage<VerifyU2FRegistrationRequest> = {
|
||||
publicKeyCredential,
|
||||
u2fId,
|
||||
userId,
|
||||
|
||||
Reference in New Issue
Block a user