mirror of
https://github.com/AsamK/signal-cli.git
synced 2026-05-30 15:14:14 +00:00
Regard pin set/remove as successful if at least one svr version worked
Fixes #1868
This commit is contained in:
parent
552ce6b06d
commit
13e6445498
@ -23,11 +23,15 @@ public class PinHelper {
|
|||||||
|
|
||||||
public void setRegistrationLockPin(String pin, MasterKey masterKey) throws IOException {
|
public void setRegistrationLockPin(String pin, MasterKey masterKey) throws IOException {
|
||||||
IOException exception = null;
|
IOException exception = null;
|
||||||
|
var setPinSuccessfully = false;
|
||||||
for (final var secureValueRecovery : secureValueRecoveries) {
|
for (final var secureValueRecovery : secureValueRecoveries) {
|
||||||
try {
|
try {
|
||||||
final var backupResponse = secureValueRecovery.setPin(pin, masterKey).execute();
|
final var backupResponse = secureValueRecovery.setPin(pin, masterKey).execute();
|
||||||
switch (backupResponse) {
|
switch (backupResponse) {
|
||||||
case SecureValueRecovery.BackupResponse.Success success -> logger.trace("PIN set successfully");
|
case SecureValueRecovery.BackupResponse.Success success -> {
|
||||||
|
setPinSuccessfully = true;
|
||||||
|
logger.trace("PIN set successfully");
|
||||||
|
}
|
||||||
case SecureValueRecovery.BackupResponse.ServerRejected serverRejected ->
|
case SecureValueRecovery.BackupResponse.ServerRejected serverRejected ->
|
||||||
logger.warn("Backup svr failed: ServerRejected");
|
logger.warn("Backup svr failed: ServerRejected");
|
||||||
case SecureValueRecovery.BackupResponse.EnclaveNotFound enclaveNotFound ->
|
case SecureValueRecovery.BackupResponse.EnclaveNotFound enclaveNotFound ->
|
||||||
@ -43,7 +47,7 @@ public class PinHelper {
|
|||||||
exception = e;
|
exception = e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (exception != null) {
|
if (!setPinSuccessfully && exception != null) {
|
||||||
throw exception;
|
throw exception;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -54,11 +58,13 @@ public class PinHelper {
|
|||||||
|
|
||||||
public void removeRegistrationLockPin() throws IOException {
|
public void removeRegistrationLockPin() throws IOException {
|
||||||
IOException exception = null;
|
IOException exception = null;
|
||||||
|
var removedPinSuccessfully = false;
|
||||||
for (final var secureValueRecovery : secureValueRecoveries) {
|
for (final var secureValueRecovery : secureValueRecoveries) {
|
||||||
try {
|
try {
|
||||||
final var deleteResponse = secureValueRecovery.deleteData();
|
final var deleteResponse = secureValueRecovery.deleteData();
|
||||||
switch (deleteResponse) {
|
switch (deleteResponse) {
|
||||||
case SecureValueRecovery.DeleteResponse.Success success -> {
|
case SecureValueRecovery.DeleteResponse.Success success -> {
|
||||||
|
removedPinSuccessfully = true;
|
||||||
}
|
}
|
||||||
case SecureValueRecovery.DeleteResponse.ServerRejected serverRejected ->
|
case SecureValueRecovery.DeleteResponse.ServerRejected serverRejected ->
|
||||||
logger.warn("Delete svr2 failed: ServerRejected");
|
logger.warn("Delete svr2 failed: ServerRejected");
|
||||||
@ -73,7 +79,7 @@ public class PinHelper {
|
|||||||
exception = e;
|
exception = e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (exception != null) {
|
if (!removedPinSuccessfully && exception != null) {
|
||||||
throw exception;
|
throw exception;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user