Check if account is already registered before attempting verification

This commit is contained in:
AsamK 2023-11-03 19:59:39 +01:00
parent 895740755d
commit b41ebfe6b8

View file

@ -129,6 +129,10 @@ public class RegistrationManagerImpl implements RegistrationManager {
public void verifyAccount( public void verifyAccount(
String verificationCode, String pin String verificationCode, String pin
) throws IOException, PinLockedException, IncorrectPinException { ) throws IOException, PinLockedException, IncorrectPinException {
if (account.isRegistered()) {
throw new IOException("Account is already registered");
}
if (account.getPniIdentityKeyPair() == null) { if (account.getPniIdentityKeyPair() == null) {
account.setPniIdentityKeyPair(KeyUtils.generateIdentityKeyPair()); account.setPniIdentityKeyPair(KeyUtils.generateIdentityKeyPair());
} }