mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 02:20:39 +00:00
Check if the username is a valid phone number with country code
This commit is contained in:
parent
b6684906fc
commit
c1abc12907
1 changed files with 5 additions and 0 deletions
|
@ -27,6 +27,7 @@ import org.whispersystems.textsecure.api.push.exceptions.EncapsulatedExceptions;
|
|||
import org.whispersystems.textsecure.api.push.exceptions.NetworkFailureException;
|
||||
import org.whispersystems.textsecure.api.push.exceptions.UnregisteredUserException;
|
||||
import org.whispersystems.textsecure.api.util.InvalidNumberException;
|
||||
import org.whispersystems.textsecure.api.util.PhoneNumberFormatter;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
|
@ -347,6 +348,10 @@ public class Main {
|
|||
System.err.println("You need to specify a username (phone number)");
|
||||
System.exit(2);
|
||||
}
|
||||
if (!PhoneNumberFormatter.isValidNumber(ns.getString("username"))) {
|
||||
System.err.println("Invalid username (phone number), make sure you include the country code.");
|
||||
System.exit(2);
|
||||
}
|
||||
if (ns.getList("recipient") != null && !ns.getList("recipient").isEmpty() && ns.getString("group") != null) {
|
||||
System.err.println("You cannot specify recipients by phone number and groups a the same time");
|
||||
System.exit(2);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue