Bugzilla – Attachment 108979 Details for
Bug 26285
Use country code + number (E.164) validation for SMS numbers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26285: Follow E.164 pattern for validating SMS numbers
Bug-26285-Follow-E164-pattern-for-validating-SMS-n.patch (text/plain), 2.35 KB, created by
ByWater Sandboxes
on 2020-08-24 10:16:43 UTC
(
hide
)
Description:
Bug 26285: Follow E.164 pattern for validating SMS numbers
Filename:
MIME Type:
Creator:
ByWater Sandboxes
Created:
2020-08-24 10:16:43 UTC
Size:
2.35 KB
patch
obsolete
>From 1619e59017eac07f51e337b9be7b416e38faddaf Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Mon, 24 Aug 2020 06:42:27 +0000 >Subject: [PATCH] Bug 26285: Follow E.164 pattern for validating SMS numbers > >Currently, Koha is not correctly validating SMS numbers using >E.164. This causes Australian phone numbers without a country code >to fail validation. > >This patch uses the E.164 pattern of 1-3 digits for country code, >prefixed by a + symbol, and followed by up to 12 digits for >the remainder of the phone number. > >To test: > >0. Don't apply patch yet >1. Set "SMSSendDriver" to "Anything" >2. Go to http://localhost:8081/cgi-bin/koha/members/memberentry.pl?op=modify&destination=circ&borrowernumber=51 >3. Type in 0455555555 and note "Please enter a valid phone number." message in browser > >6. Apply the patch > >7. Go to http://localhost:8081/cgi-bin/koha/members/memberentry.pl?op=modify&destination=circ&borrowernumber=51 >8. Type in 0455555555 and note no validation error >9. Type in +61455555555 and note no validation error >10. Type in 123456789012 and note no validation error >11. Type in 1234567890123 and note "Please enter a valid phone number." error >12. Type in +900123456789012 and note no validation error >13. Type in 900123456789012 and note "Please enter a valid phone number." error > >Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk> >--- > koha-tmpl/intranet-tmpl/prog/js/members.js | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/members.js b/koha-tmpl/intranet-tmpl/prog/js/members.js >index 4de6e6e198..68d5e4277d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/members.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/members.js >@@ -314,15 +314,13 @@ $(document).ready(function(){ > $.validator.addMethod( > "phone", > function(value, element, phone) { >- var e164 = "^\\+?[1-9]\\d{1,14}$"; >- var re = new RegExp(e164); >- >+ let e164_re = /^(\+[1-9]\d{0,2})?\d{1,12}$/; > let has_plus = value.charAt(0) === '+'; > value = value.replace(/\D/g,''); > if ( has_plus ) value = '+' + value; > element.value = value; > >- return this.optional(element) || re.test(value); >+ return this.optional(element) || e164_re.test(value); > }, > jQuery.validator.messages.phone); > >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 26285
:
108964
|
108979
|
109034
|
109135
|
109542
|
109543