[bisq-network/bisq] Validate phone numbers (#3134)

Stan notifications at github.com
Sat Aug 24 15:12:17 UTC 2019


ghubstan commented on this pull request.



> +        this.callingCode = countryCallingCodes.getCallingCode(isoCountryCode);
+        this.normalizedCallingCode = countryCallingCodes.getNormalizedCallingCode(isoCountryCode);
+    }
+
+
+    @Override
+    public ValidationResult validate(String input) {
+        normalizedPhoneNumber = null;
+        ValidationResult result = super.validate(input);
+        if (!result.isValid) {
+            return result;
+        }
+        final String trimmedInput = input.trim();
+        boolean isCountryDialingCodeExplicit = trimmedInput.startsWith("+");
+        // remove non-digit chars:  plus sign, dashes, parens, hashes, slashes and white spaces
+        String pureNumber = input.replaceAll("[\\+\\s+()\\-\\−\\#\\\\]", "");

Letters need to be included in the pureNumber string for the isPositiveNumber test.  I had a US number with letters, and I'm sure they still exist in other countries.  A number with letters may be valid, but the user will be prompted to convert them to  numbers for successful validation.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/3134#discussion_r317364695
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20190824/f3025f34/attachment-0001.html>


More information about the bisq-github mailing list