cds-snc / report-a-cybercrime

Report a computer crime or scam / Signaler un crime informatique ou une fraude
https://report-a-scam.cds-snc.ca
MIT License
29 stars 14 forks source link

PR2189 enhanced phone information (International Number and validation) AND add phone extension #2368

Closed dengcn closed 4 years ago

dengcn commented 4 years ago

Fixes #2189

Description

This is a feature delivery for followings

Please include a summary of the change. -regex -yupschema -contactform validation -summary report -Analyst report

Any new packages installed?

Give details

Required followup work

Is there anything related to this that still needs to be done (ex: documentation changes).

Checklist:

lgtm-com[bot] commented 4 years ago

This pull request introduces 1 alert when merging 37a06189ebdcae2b9f893dc3ea96c4b59051bf32 into 9297d3096c2eed44a182014309974d9a420506a4 - view on LGTM.com

new alerts:

dengcn commented 4 years ago

FYI:

The followings are examples of good international number formats which will get validation pass. This had been communicated with Norm, Stephanie and Hong.

'00116131122323' //=> true '163454516131122323' //=> true '++1-7134445+345' //=> true '1.713.444.5345' //=> true '+09-323-333-3332' //=> true '853-12349543' //=> true '8534444' //=> true '(1)-(613)-(222-3333) //=> true

Checked with some international number specs, it requires Minimum 7 digits (some smallest country may fit into 7 digits).
+, -, . , () are allowed, and any character other than these 5 and 10 digits will fail to pass validation.

Extension number is also validated, only [0] to [9] are allowed, otherwise error message will show

dengcn commented 4 years ago

2189InternationalNumberExtension

dengcn commented 4 years ago

From discussion with Stephanie and others in General section of TEAM, Phone validation is updated to ensure valid digits of phone should be more than or equal to 10 digits to ensure area code is captured. Max number is still 15 digits for international number use. Such code changes had been committed to GIT, and all test pass.