diff --git a/server.js b/server.js index 6392e98..65961b1 100644 --- a/server.js +++ b/server.js @@ -260,7 +260,8 @@ app.post('/api/contact', async (req, res) => { // Admin login (creates admin on first login if none exist) app.post('/api/admin/login', async (req, res) => { try { - const { email, password, fullName } = req.body; + const { email, password, fullName, 'full-name': fullNameHyphen } = req.body; + const name = fullName || fullNameHyphen; if (!email || !password) { return res.status(400).json({ error: 'Email and password are required' }); @@ -272,14 +273,14 @@ app.post('/api/admin/login', async (req, res) => { if (isFirstAdmin) { // Create first admin - if (!fullName) { + if (!name) { return res.status(400).json({ error: 'Full name is required for first admin creation' }); } const hashedPassword = await bcrypt.hash(password, 10); const result = await pool.query( 'INSERT INTO admins (email, password_hash, full_name) VALUES ($1, $2, $3) RETURNING id, email, full_name', - [email, hashedPassword, fullName] + [email, hashedPassword, name] ); const admin = result.rows[0];