fix(push): reject phone input shorter than 10 digits (was accepting '7')
This commit is contained in:
parent
bdeb055fae
commit
47a06bb285
|
|
@ -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;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue