Actualizar server.js
This commit is contained in:
@@ -424,8 +424,6 @@ function extractValidPhone(rawPhone) {
|
||||
const digits = str.replace(/\D/g, ""); // Si falla, coge los primeros 9 números que pille
|
||||
return digits.length >= 9 ? digits.substring(0, 9) : digits;
|
||||
}
|
||||
function normalizePhone(phone) { let p = String(phone || "").trim().replace(/\s+/g, "").replace(/-/g, ""); if (!p) return ""; if (!p.startsWith("+") && /^[6789]\d{8}/.test(p)) return "+34" + p; return p; }
|
||||
|
||||
|
||||
function normalizePhone(phone) { let p = String(phone || "").trim().replace(/\s+/g, "").replace(/-/g, ""); if (!p) return ""; if (!p.startsWith("+") && /^[6789]\d{8}/.test(p)) return "+34" + p; return p; }
|
||||
function signToken(user) { const accountId = user.owner_id || user.id; return jwt.sign({ sub: user.id, email: user.email, phone: user.phone, role: user.role || 'operario', accountId }, JWT_SECRET, { expiresIn: "30d" }); }
|
||||
|
||||
Reference in New Issue
Block a user