Actualizar server.js
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user