From 89c75564cf6f4e462273f52839c54ad4cc936a9e Mon Sep 17 00:00:00 2001 From: Ryderjj89 Date: Mon, 29 Sep 2025 20:21:55 -0400 Subject: [PATCH] Add default admin user creation and fix modal overlay positioning --- assets/css/main.css | 38 ++++++++++++++++++++++++++++++++++++++ server/utils/database.ts | 11 ++++++++++- 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/assets/css/main.css b/assets/css/main.css index 0fe2ea4..0aaa328 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -410,3 +410,41 @@ img[src*="logo"], .logo-image { max-height: 2rem !important; object-fit: contain !important; } + +/* Modal styling - FORCE overlay positioning */ +.nui-modal { + position: fixed !important; + top: 0 !important; + left: 0 !important; + right: 0 !important; + bottom: 0 !important; + z-index: 9999 !important; + display: flex !important; + align-items: center !important; + justify-content: center !important; + background-color: rgba(0, 0, 0, 0.5) !important; + backdrop-filter: blur(4px) !important; +} + +.nui-modal-overlay { + position: fixed !important; + top: 0 !important; + left: 0 !important; + right: 0 !important; + bottom: 0 !important; + background-color: rgba(0, 0, 0, 0.5) !important; + backdrop-filter: blur(4px) !important; +} + +.nui-modal-content { + background: white !important; + border-radius: 0.5rem !important; + box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2) !important; + max-width: 400px !important; + max-height: 90vh !important; + overflow: auto !important; + position: relative !important; + z-index: 10000 !important; + margin: 1rem !important; + width: 100% !important; +} diff --git a/server/utils/database.ts b/server/utils/database.ts index afed70f..d6b31f0 100644 --- a/server/utils/database.ts +++ b/server/utils/database.ts @@ -51,7 +51,16 @@ async function initializeDatabase(db: Database.Database) { ) `) - // Note: Admin user creation is handled in auth.ts to avoid circular dependencies + // Create default admin user if it doesn't exist + const config = useRuntimeConfig() + const bcrypt = await import('bcrypt') + const saltRounds = 10 + const passwordHash = await bcrypt.hash(config.adminPassword, saltRounds) + + const existingAdmin = db.prepare('SELECT id FROM users WHERE username = ?').get('admin') + if (!existingAdmin) { + db.prepare('INSERT INTO users (username, password_hash) VALUES (?, ?)').run('admin', passwordHash) + } } export function closeDatabase() {