From f9784f8efabce5bfbfa13619454f202d3e3164e4 Mon Sep 17 00:00:00 2001 From: marsalva Date: Thu, 5 Mar 2026 14:39:01 +0000 Subject: [PATCH] Actualizar server.js --- server.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server.js b/server.js index e8d41a6..6039bb9 100644 --- a/server.js +++ b/server.js @@ -383,10 +383,13 @@ async function requirePlan(req, res, next, feature) { app.post("/auth/login", async (req, res) => { try { - const { identifier, password } = req.body; + // 🚨 MEJORA: Aceptamos identifier, email o phone para que no falle nunca con el frontend + const identifier = req.body.identifier || req.body.email || req.body.phone; + const password = req.body.password; + if (!identifier || !password) return res.status(400).json({ ok: false, error: "Faltan datos" }); - const identClean = identifier.replace(/\s+/g, '').trim(); + const identClean = String(identifier).replace(/\s+/g, '').trim(); // Buscamos al usuario por email o por teléfono (con o sin +34) const q = await pool.query(