First fully working user management, move to layout groups

This commit is contained in:
2023-07-18 14:18:52 +02:00
parent 70e640aa9a
commit 7dd52d8890
55 changed files with 366 additions and 192 deletions

View File

@ -5,9 +5,8 @@ import { error } from "@sveltejs/kit";
import { dbConnect, dbDisconnect } from "../../utils/db";
import { User } from "../../models/User";;
export async function authenticateUser(event: RequestEvent){
export async function authenticateUser(cookies){
// Set your master secret key (replace with your own secret)
const { cookies } = event;
const masterSecret = COOKIE_SECRET;
const secretKey = masterSecret
let decoded
@ -19,7 +18,7 @@ export async function authenticateUser(event: RequestEvent){
}
catch(e){
throw error(401, "Cookies have changed, please log in again")
return null
}
if(decoded){