From 0dc33e18923b1e5770850cb5a803dae1b510e80a Mon Sep 17 00:00:00 2001 From: AsamK Date: Sat, 13 Feb 2021 18:40:27 +0100 Subject: [PATCH] Add more information for CaptchaRequiredException --- .../org/asamk/signal/commands/RegisterCommand.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/asamk/signal/commands/RegisterCommand.java b/src/main/java/org/asamk/signal/commands/RegisterCommand.java index da652f7d..f7736018 100644 --- a/src/main/java/org/asamk/signal/commands/RegisterCommand.java +++ b/src/main/java/org/asamk/signal/commands/RegisterCommand.java @@ -22,13 +22,21 @@ public class RegisterCommand implements RegistrationCommand { @Override public int handleCommand(final Namespace ns, final RegistrationManager m) { + final boolean voiceVerification = ns.getBoolean("voice"); + final String captcha = ns.getString("captcha"); + try { - final boolean voiceVerification = ns.getBoolean("voice"); - final String captcha = ns.getString("captcha"); m.register(voiceVerification, captcha); return 0; } catch (CaptchaRequiredException e) { - System.err.println("Captcha invalid or required for verification (" + e.getMessage() + ")"); + if (captcha == null) { + System.err.println("Captcha required for verification, use --captcha CAPTCHA"); + System.err.println("To get the token, go to https://signalcaptchas.org/registration/generate.html"); + System.err.println("Check the developer tools (F12) console for a failed redirect to signalcaptcha://"); + System.err.println("Everything after signalcaptcha:// is the captcha token."); + } else { + System.err.println("Invalid captcha given."); + } return 1; } catch (IOException e) { System.err.println("Request verify error: " + e.getMessage());