Add default admin user creation and fix modal overlay positioning
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user