Skip to content

Commit 701eb3a

Browse files
unfuncoishakhsuvarov
authored andcommitted
Fix UK mobile number validation
The validation for UK mobile numbers is too restrictive on the third digit, my own phone number begins 074 and the current validator does not return a valid match, this loosens the restriction.
1 parent f1dc91b commit 701eb3a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ define([
235235
],
236236
'mobileUK': [
237237
function (value) {
238-
return value.length > 9 && value.match(/^((0|\+44)7(5|6|7|8|9){1}\d{2}\s?\d{6})$/);
238+
return value.length > 9 && value.match(/^((0|\+44)7\d{3}\s?\d{6})$/);
239239
},
240240
$.mage.__('Please specify a valid mobile number')
241241
],

lib/web/mage/validation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@
384384
'mobileUK': [
385385
function (phoneNumber, element) {
386386
return this.optional(element) || phoneNumber.length > 9 &&
387-
phoneNumber.match(/^((0|\+44)7(5|6|7|8|9){1}\d{2}\s?\d{6})$/);
387+
phoneNumber.match(/^((0|\+44)7\d{3}\s?\d{6})$/);
388388
},
389389
$.mage.__('Please specify a valid mobile number')
390390
],

0 commit comments

Comments
 (0)