From c2d8c9a66203f25b421b716b0b59cdd0b755444e Mon Sep 17 00:00:00 2001 From: Mikkel Kroman Date: Mon, 21 Nov 2016 21:09:38 +0100 Subject: [PATCH] Faroese phone numbers are 6 digits in length and has a 3-digit dialing code, but the validation regex requires 10-digit numbers. Validates numbers the same way libsignal-service-java does it. Closes #72 --- .../java/org/whispersystems/textsecuregcm/util/Util.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/whispersystems/textsecuregcm/util/Util.java b/src/main/java/org/whispersystems/textsecuregcm/util/Util.java index 441a70b64..e07794e23 100644 --- a/src/main/java/org/whispersystems/textsecuregcm/util/Util.java +++ b/src/main/java/org/whispersystems/textsecuregcm/util/Util.java @@ -43,7 +43,11 @@ public class Util { } public static boolean isValidNumber(String number) { - return number.matches("^\\+[0-9]{10,}"); + return number.matches("^\\+[0-9]{10,}") || + number.matches("^\\+298[0-9]{6}") || + number.matches("^\\+240[0-9]{6}") || + number.matches("^\\+687[0-9]{6}") || + number.matches("^\\+689[0-9]{6}"); } public static String encodeFormParams(Map params) {