From ae8c1ccfbab4f8769095978540ce83dce7264797 Mon Sep 17 00:00:00 2001 From: Maksym Mykhailenko Date: Mon, 5 Nov 2018 19:45:31 +0800 Subject: [PATCH 1/3] fix phone validation to require country code, also make it accept more phone formats --- .../settings/routes/profile/components/ProfileSettingsForm.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/settings/routes/profile/components/ProfileSettingsForm.jsx b/src/routes/settings/routes/profile/components/ProfileSettingsForm.jsx index 98214124b..ea367b75f 100644 --- a/src/routes/settings/routes/profile/components/ProfileSettingsForm.jsx +++ b/src/routes/settings/routes/profile/components/ProfileSettingsForm.jsx @@ -40,7 +40,7 @@ class ProfileSettingsForm extends Component { let validations = null if (name === 'businessPhone') { validations = { - matchRegexp: /^([+]?\d{1,2}[.-\s]?)?(\d{3}[.-]?){2}\d{4}$/ + matchRegexp: /^([+]\d{1,3}[\.\-\s]?)(\d{2,4}[\.\-\s]?){2,3}$/ } } else if (name === 'firstNLastName') { validations = { From c2e854af265c3f8e0d92639392c31cdf9a25cdb5 Mon Sep 17 00:00:00 2001 From: Maksym Mykhailenko Date: Mon, 5 Nov 2018 20:00:26 +0800 Subject: [PATCH 2/3] lin fix --- .../settings/routes/profile/components/ProfileSettingsForm.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/settings/routes/profile/components/ProfileSettingsForm.jsx b/src/routes/settings/routes/profile/components/ProfileSettingsForm.jsx index ea367b75f..37a2ae204 100644 --- a/src/routes/settings/routes/profile/components/ProfileSettingsForm.jsx +++ b/src/routes/settings/routes/profile/components/ProfileSettingsForm.jsx @@ -40,7 +40,7 @@ class ProfileSettingsForm extends Component { let validations = null if (name === 'businessPhone') { validations = { - matchRegexp: /^([+]\d{1,3}[\.\-\s]?)(\d{2,4}[\.\-\s]?){2,3}$/ + matchRegexp: /^(\+\d{1,3}[.\-\s]?)(\d{2,4}[.\-\s]?){3}$/ } } else if (name === 'firstNLastName') { validations = { From 9e82dd90029b85e29a49a5787600fa880cd5f758 Mon Sep 17 00:00:00 2001 From: Maksym Mykhailenko Date: Tue, 6 Nov 2018 09:21:16 +0800 Subject: [PATCH 3/3] use validation regexp for businessPhone same like in the member-service --- .../settings/routes/profile/components/ProfileSettingsForm.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/routes/settings/routes/profile/components/ProfileSettingsForm.jsx b/src/routes/settings/routes/profile/components/ProfileSettingsForm.jsx index 37a2ae204..880ffd1ff 100644 --- a/src/routes/settings/routes/profile/components/ProfileSettingsForm.jsx +++ b/src/routes/settings/routes/profile/components/ProfileSettingsForm.jsx @@ -40,7 +40,8 @@ class ProfileSettingsForm extends Component { let validations = null if (name === 'businessPhone') { validations = { - matchRegexp: /^(\+\d{1,3}[.\-\s]?)(\d{2,4}[.\-\s]?){3}$/ + // use same regexp as on server side + matchRegexp: /^\+(?:[0-9] ?){6,14}[0-9]$/ } } else if (name === 'firstNLastName') { validations = {