Add registration page, fix auth paths, and improve navigation

This commit is contained in:
Torsten Schulz (local)
2025-10-21 11:31:43 +02:00
parent 2b249577a7
commit f058516a3d
86 changed files with 2914 additions and 531 deletions

View File

@@ -1,2 +1,9 @@
[]
[
{
"id": "1761039055753",
"userId": "1",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjEiLCJlbWFpbCI6ImFkbWluQGhhcmhlaW1lcnRjLmRlIiwicm9sZSI6ImFkbWluIiwiaWF0IjoxNzYxMDM5MDU1LCJleHAiOjE3NjE2NDM4NTV9.YkdCMn7N9lmYonyTF-uPE5UbvW2wfOf7kqk_ib0a7Ks",
"createdAt": "2025-10-21T09:30:55.753Z",
"expiresAt": "2025-10-28T09:30:55.753Z"
}
]

View File

@@ -2,12 +2,11 @@
{
"id": "1",
"email": "admin@harheimertc.de",
"password": "$2a$10$rKqW8x3k5vJ8pZ7mN9qL1OXxYzQ2wF3bH4cT6nR8sV9kL0mP1qW2e",
"password": "$2a$10$7/he4Q2OC/z1ZXStsPOYWeEc2szOCEgNQFwb4txeB0zTt/Wm1eJKa",
"name": "Admin",
"role": "admin",
"phone": "",
"created": "2025-10-21T00:00:00.000Z",
"lastLogin": null
"lastLogin": "2025-10-21T09:30:55.754Z"
}
]
]

View File

@@ -2,10 +2,25 @@ import bcrypt from 'bcryptjs'
import jwt from 'jsonwebtoken'
import { promises as fs } from 'fs'
import path from 'path'
import { fileURLToPath } from 'url'
const JWT_SECRET = process.env.JWT_SECRET || 'harheimertc-secret-key-change-in-production'
const USERS_FILE = path.join(process.cwd(), 'server/data/users.json')
const SESSIONS_FILE = path.join(process.cwd(), 'server/data/sessions.json')
// Handle both dev and production paths
const getDataPath = (filename) => {
const cwd = process.cwd()
// In production (.output/server), working dir is .output
if (cwd.endsWith('.output')) {
return path.join(cwd, '../server/data', filename)
}
// In development, working dir is project root
return path.join(cwd, 'server/data', filename)
}
const USERS_FILE = getDataPath('users.json')
const SESSIONS_FILE = getDataPath('sessions.json')
// Read users from file
export async function readUsers() {