From a45cfe487bcd7cb9ad91967a0870d4dd6b07c4dd Mon Sep 17 00:00:00 2001 From: Martin Mena Date: Wed, 30 Oct 2019 10:21:16 -0500 Subject: [PATCH 1/2] Enforce stricter Ecuador phone number validation --- src/lib/isMobilePhone.js | 2 +- test/validators.js | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/lib/isMobilePhone.js b/src/lib/isMobilePhone.js index 7b4f04675..2e5d7a70d 100644 --- a/src/lib/isMobilePhone.js +++ b/src/lib/isMobilePhone.js @@ -41,7 +41,7 @@ const phones = { 'en-ZA': /^(\+?27|0)\d{9}$/, 'en-ZM': /^(\+?26)?09[567]\d{7}$/, 'es-CL': /^(\+?56|0)[2-9]\d{1}\d{7}$/, - 'es-EC': /^(\+?593|0)[2-7,9]\d{7,8}$/, + 'es-EC': /^(\+?593|0)([2-7]|9[2-9])\d{7}$/, 'es-ES': /^(\+?34)?(6\d{1}|7[1234])\d{7}$/, 'es-MX': /^(\+?52)?(1|01)?\d{10,11}$/, 'es-PA': /^(\+?507)\d{7,8}$/, diff --git a/test/validators.js b/test/validators.js index f78edf980..56b3b45ce 100644 --- a/test/validators.js +++ b/test/validators.js @@ -4644,9 +4644,9 @@ describe('Validators', () => { { locale: 'es-EC', valid: [ - '+593995414585', - '593912345677', - '0915114585', + '+593987654321', + '593987654321', + '0987654321', '027332615', ], invalid: [ @@ -4656,6 +4656,10 @@ describe('Validators', () => { '02344635', '593123456789', '081234567', + '+593912345678', + '+593902345678', + '+593287654321', + '593287654321', ], }, { From 4ed83600df04a0a62287de21485aa07b4261f592 Mon Sep 17 00:00:00 2001 From: Martin Mena Date: Thu, 31 Oct 2019 11:22:51 -0500 Subject: [PATCH 2/2] Add more tests --- test/validators.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/validators.js b/test/validators.js index 56b3b45ce..8ac0e9f08 100644 --- a/test/validators.js +++ b/test/validators.js @@ -4648,6 +4648,7 @@ describe('Validators', () => { '593987654321', '0987654321', '027332615', + '+59323456789', ], invalid: [ '03321321',