mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-12 09:54:00 +00:00
cleanup
This commit is contained in:
@@ -2,13 +2,11 @@ import { createCallback, getSession, server } from "#/lib/zitadel";
|
||||
import UserAvatar from "#/ui/UserAvatar";
|
||||
import { getMostRecentCookieWithLoginname } from "#/utils/cookies";
|
||||
import { redirect } from "next/navigation";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
async function loadSession(loginName: string, authRequestId?: string) {
|
||||
const recent = await getMostRecentCookieWithLoginname(`${loginName}`);
|
||||
|
||||
if (authRequestId) {
|
||||
console.log(authRequestId);
|
||||
return createCallback(server, {
|
||||
authRequestId,
|
||||
session: { sessionId: recent.id, sessionToken: recent.token },
|
||||
|
||||
@@ -1,52 +1,12 @@
|
||||
import {
|
||||
getSession,
|
||||
listAuthenticationMethodTypes,
|
||||
server,
|
||||
} from "#/lib/zitadel";
|
||||
import { getSessionCookieById } from "#/utils/cookies";
|
||||
import { listAuthenticationMethodTypes } from "#/lib/zitadel";
|
||||
import { createSessionAndUpdateCookie } from "#/utils/session";
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
|
||||
// export async function GET(request: NextRequest) {
|
||||
// const { searchParams } = new URL(request.url);
|
||||
// const sessionId = searchParams.get("sessionId");
|
||||
// if (sessionId) {
|
||||
// const sessionCookie = await getSessionCookieById(sessionId);
|
||||
|
||||
// const session = await getSession(
|
||||
// server,
|
||||
// sessionCookie.id,
|
||||
// sessionCookie.token
|
||||
// );
|
||||
|
||||
// const userId = session?.session?.factors?.user?.id;
|
||||
|
||||
// if (userId) {
|
||||
// return listAuthenticationMethodTypes(userId)
|
||||
// .then((methods) => {
|
||||
// return NextResponse.json(methods);
|
||||
// })
|
||||
// .catch((error) => {
|
||||
// return NextResponse.json(error, { status: 500 });
|
||||
// });
|
||||
// } else {
|
||||
// return NextResponse.json(
|
||||
// { details: "could not get session" },
|
||||
// { status: 500 }
|
||||
// );
|
||||
// }
|
||||
// } else {
|
||||
// return NextResponse.json({}, { status: 400 });
|
||||
// }
|
||||
// }
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
const body = await request.json();
|
||||
if (body) {
|
||||
const { loginName, authRequestId } = body;
|
||||
|
||||
// const domain: string = request.nextUrl.hostname;
|
||||
|
||||
return createSessionAndUpdateCookie(
|
||||
loginName,
|
||||
undefined,
|
||||
|
||||
@@ -18,8 +18,6 @@ export async function POST(request: NextRequest) {
|
||||
if (body) {
|
||||
const { loginName, password } = body;
|
||||
|
||||
// const domain: string = request.nextUrl.hostname;
|
||||
|
||||
return createSessionAndUpdateCookie(
|
||||
loginName,
|
||||
password,
|
||||
|
||||
@@ -31,7 +31,6 @@ export default function LoginPasskey({
|
||||
setLoading(true);
|
||||
updateSessionForChallenge()
|
||||
.then((response) => {
|
||||
console.log(response);
|
||||
const pK =
|
||||
response.challenges.webAuthN.publicKeyCredentialRequestOptions
|
||||
.publicKey;
|
||||
@@ -85,7 +84,6 @@ export default function LoginPasskey({
|
||||
|
||||
async function submitLogin(data: any) {
|
||||
setLoading(true);
|
||||
console.log(data);
|
||||
const res = await fetch("/api/session", {
|
||||
method: "PUT",
|
||||
headers: {
|
||||
|
||||
Reference in New Issue
Block a user