public class RegisterCommand implements RegistrationCommand {
+ @Override
+ public String getName() {
+ return "register";
+ }
+
@Override
public void attachToSubparser(final Subparser subparser) {
subparser.help("Register a phone number with SMS or voice verification.");
@Override
public void handleCommand(final Namespace ns, final RegistrationManager m) throws CommandException {
- final boolean voiceVerification = ns.getBoolean("voice");
+ final boolean voiceVerification = Boolean.TRUE.equals(ns.getBoolean("voice"));
final var captchaString = ns.getString("captcha");
final var captcha = captchaString == null ? null : captchaString.replace("signalcaptcha://", "");
} catch (CaptchaRequiredException e) {
String message;
if (captcha == null) {
- message = "Captcha required for verification, use --captcha CAPTCHA\n"
- + "To get the token, go to https://signalcaptchas.org/registration/generate.html\n"
- + "Check the developer tools (F12) console for a failed redirect to signalcaptcha://\n"
- + "Everything after signalcaptcha:// is the captcha token.";
+ message = """
+ Captcha required for verification, use --captcha CAPTCHA
+ To get the token, go to https://signalcaptchas.org/registration/generate.html
+ Check the developer tools (F12) console for a failed redirect to signalcaptcha://
+ Everything after signalcaptcha:// is the captcha token.""";
} else {
message = "Invalid captcha given.";
}
throw new UserErrorException(message);
} catch (IOException e) {
- throw new IOErrorException("Request verify error: " + e.getMessage());
+ throw new IOErrorException("Request verify error: " + e.getMessage(), e);
}
}
}