fix: link account
When linking device to an account show error message if pin or
password are incorrect.
Change-Id: I2cce4b51a45979bcc6d8843ae0bd1978d393ec38
diff --git a/src/RingWizardLinkAccountVC.mm b/src/RingWizardLinkAccountVC.mm
index 2239ba2..77f7e87 100644
--- a/src/RingWizardLinkAccountVC.mm
+++ b/src/RingWizardLinkAccountVC.mm
@@ -84,6 +84,8 @@
[pinTextField setStringValue:@""];
[pinTextField setEnabled:YES];
[linkButton setEnabled:NO];
+ self.passwordValue = @"";
+ self.pinValue = @"";
[passwordTextField setStringValue:@""];
}
@@ -106,6 +108,9 @@
accountCreated = QObject::connect(self.accountModel,
&lrc::api::NewAccountModel::accountAdded,
[self] (const std::string& accountID) {
+ if(accountID.compare(accountToCreate) != 0) {
+ return;
+ }
[self.delegate didLinkAccountWithSuccess:YES];
[self registerDefaultPreferences];
QObject::disconnect(accountCreated);
@@ -119,6 +124,13 @@
[self showError];
}
});
+ accountRemoved = QObject::connect(self.accountModel,
+ &lrc::api::NewAccountModel::invalidAccountDetected,
+ [self] (const std::string& accountID) {
+ if(accountID.compare(accountToCreate) == 0) {
+ [self showError];
+ }
+ });
[self showLoading];
NSString *pin = backupFile ? @"" : (self.pinValue ? self.pinValue : @"");