fix(push): reject phone input shorter than 10 digits (was accepting '7')

This commit is contained in:
Hermes 2026-08-11 15:39:53 +02:00
parent bdeb055fae
commit 47a06bb285
1 changed files with 1 additions and 0 deletions

View File

@ -16,6 +16,7 @@ const apiHeaders = {
const normalizePhone = (phone) => { const normalizePhone = (phone) => {
if (!phone) return ""; if (!phone) return "";
const clean = String(phone).replace(/\D/g, ""); const clean = String(phone).replace(/\D/g, "");
if (clean.length < 10) return ""; // too short to be a real number
if (clean.startsWith("8")) return "7" + clean.slice(1); if (clean.startsWith("8")) return "7" + clean.slice(1);
if (!clean.startsWith("7")) return "7" + clean; if (!clean.startsWith("7")) return "7" + clean;
return clean; return clean;