fix(admin): persist data directory and pass env vars
This commit is contained in:
parent
99e8201745
commit
1d7e7c41c9
39 changed files with 1297 additions and 32 deletions
16
app/api/admin/login/route.ts
Normal file
16
app/api/admin/login/route.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import { NextResponse } from "next/server";
|
||||
import { adminCookieOptions, adminSessionCookie, createAdminSession, validateAdminCredentials } from "@/lib/admin/auth";
|
||||
|
||||
export async function POST(request: Request) {
|
||||
const form = await request.formData();
|
||||
const email = String(form.get("email") ?? "");
|
||||
const password = String(form.get("password") ?? "");
|
||||
|
||||
if (!validateAdminCredentials(email, password)) {
|
||||
return NextResponse.json({ message: "Ungültige Zugangsdaten." }, { status: 401 });
|
||||
}
|
||||
|
||||
const response = NextResponse.json({ message: "Anmeldung erfolgreich." });
|
||||
response.cookies.set(adminSessionCookie, createAdminSession(), adminCookieOptions());
|
||||
return response;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue