Small changes discovered while writing documentation

This commit is contained in:
Colin McDonald 2016-07-03 19:41:01 -04:00
parent 85b98b4a1d
commit 7bb1b17575
4 changed files with 5 additions and 6 deletions

View File

@ -25,7 +25,7 @@ public final class GETUsersIdRequiresTotp implements Handler<RoutingContext> {
String userIp = ctx.request().getParam("userIp");
if (!IpUtils.isValidIp(userIp)) {
if (userIp != null && IpUtils.isValidIp(userIp)) {
ErrorUtils.respondInvalidInput(ctx, "Ip address \"" + userIp + "\" is not valid.");
return;
}

View File

@ -45,13 +45,12 @@ public final class POSTUsersIdSetupTotp implements Handler<RoutingContext> {
ErrorUtils.respondInternalError(ctx, error);
} else {
APIv3.respondJson(ctx, 200, ImmutableMap.of(
"success", true,
"message", "Totp code set."
"success", true
));
}
});
} else {
ErrorUtils.respondInvalidInput(ctx, "Confirmation code provided did not match.");
ErrorUtils.respondOther(ctx, 400, "Confirmation code provided did not match.", "badConfirmationCode", ImmutableMap.of());
}
}

View File

@ -17,7 +17,7 @@ public class ErrorUtils {
}
public static void respondInvalidInput(RoutingContext ctx, String message) {
respond(ctx, 400, "Invalid input: " + message + ".", null, null);
respond(ctx, 400, "Invalid input: " + message, null, null);
}
public static void respondRequiredInput(RoutingContext ctx, String field) {

View File

@ -8,7 +8,7 @@ import java.util.regex.Pattern;
public class PhoneUtils {
private static final Pattern VALID_PHONE_PATTERN = Pattern.compile(
"^(+1|1)?([2-9]\\d\\d[2-9]\\d{6})$",
"^\\+?[1-9]\\d{1,14}$",
Pattern.CASE_INSENSITIVE
);