Improve behavior when pin data doesn't exist on the server

This commit is contained in:
AsamK 2025-06-08 16:22:03 +02:00
parent 6b60a6d5a5
commit a0d5744c49
11 changed files with 31 additions and 9 deletions

View file

@ -9,6 +9,7 @@ import org.asamk.signal.commands.exceptions.UserErrorException;
import org.asamk.signal.manager.Manager;
import org.asamk.signal.manager.api.IncorrectPinException;
import org.asamk.signal.manager.api.NotPrimaryDeviceException;
import org.asamk.signal.manager.api.PinLockMissingException;
import org.asamk.signal.manager.api.PinLockedException;
import org.asamk.signal.output.OutputWriter;
@ -50,6 +51,8 @@ public class FinishChangeNumberCommand implements JsonRpcLocalCommand {
+ "\nUse '--pin PIN_CODE' to specify the registration lock PIN");
} catch (IncorrectPinException e) {
throw new UserErrorException("Verification failed! Invalid pin, tries remaining: " + e.getTriesRemaining());
} catch (PinLockMissingException e) {
throw new UserErrorException("Account is pin locked, but pin data has been deleted on the server.");
} catch (NotPrimaryDeviceException e) {
throw new UserErrorException("This command doesn't work on linked devices.");
} catch (IOException e) {

View file

@ -11,6 +11,7 @@ import org.asamk.signal.commands.exceptions.IOErrorException;
import org.asamk.signal.commands.exceptions.UserErrorException;
import org.asamk.signal.manager.RegistrationManager;
import org.asamk.signal.manager.api.IncorrectPinException;
import org.asamk.signal.manager.api.PinLockMissingException;
import org.asamk.signal.manager.api.PinLockedException;
import org.asamk.signal.output.JsonWriter;
import org.slf4j.Logger;
@ -76,6 +77,8 @@ public class VerifyCommand implements RegistrationCommand, JsonRpcRegistrationCo
+ "\nUse '--pin PIN_CODE' to specify the registration lock PIN");
} catch (IncorrectPinException e) {
throw new UserErrorException("Verification failed! Invalid pin, tries remaining: " + e.getTriesRemaining());
} catch (PinLockMissingException e) {
throw new UserErrorException("Account is pin locked, but pin data has been deleted on the server.");
} catch (IOException e) {
throw new IOErrorException("Verify error: " + e.getMessage(), e);
}

View file

@ -10,6 +10,7 @@ import org.asamk.signal.manager.RegistrationManager;
import org.asamk.signal.manager.api.CaptchaRequiredException;
import org.asamk.signal.manager.api.IncorrectPinException;
import org.asamk.signal.manager.api.NonNormalizedPhoneNumberException;
import org.asamk.signal.manager.api.PinLockMissingException;
import org.asamk.signal.manager.api.PinLockedException;
import org.asamk.signal.manager.api.RateLimitException;
import org.asamk.signal.manager.api.UserAlreadyExistsException;
@ -105,6 +106,8 @@ public class DbusSignalControlImpl implements org.asamk.SignalControl {
+ (e.getTimeRemaining() / 1000 / 60 / 60));
} catch (IncorrectPinException e) {
throw new Error.Failure("Verification failed! Invalid pin, tries remaining: " + e.getTriesRemaining());
} catch (PinLockMissingException e) {
throw new Error.Failure("Account is pin locked, but pin data has been deleted on the server.");
}
}