diff --git a/app/api/user/login.ts/route.ts b/app/api/user/login.ts/route.ts index bace97c..0317998 100644 --- a/app/api/user/login.ts/route.ts +++ b/app/api/user/login.ts/route.ts @@ -6,6 +6,7 @@ import prisma from "@/app/prisma"; interface Body { username: string; password: string; + remember?: boolean; } export async function POST(request: NextRequest) { @@ -36,7 +37,7 @@ export async function POST(request: NextRequest) { return NextResponse.json({ error: "No JWT secret found" }, { status: 500 }); } - const token = jwt.sign({ id: user.id }, process.env.JWT_SECRET, { expiresIn: "7d" }); + const token = jwt.sign({ id: user.id }, process.env.JWT_SECRET, { expiresIn: body.remember ? "7d" : "1h" }); return NextResponse.json({ message: "Login successful", token }, { status: 200 });