Force non-cancellable session verification when needed (account migration / interrupted authentication)

This commit is contained in:
Arnaud Ringenbach 2022-03-09 10:42:29 +01:00
parent 082cc520fe
commit 088ddd4972
3 changed files with 12 additions and 2 deletions

View file

@ -4281,6 +4281,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
if (!keyVerificationCoordinatorBridgePresenter.isPresenting)
{
keyVerificationCoordinatorBridgePresenter = [[KeyVerificationCoordinatorBridgePresenter alloc] initWithSession:mxSession];
keyVerificationCoordinatorBridgePresenter.cancellable = !mxSession.vc_homeserverConfiguration.encryption.isSecureBackupRequired;
keyVerificationCoordinatorBridgePresenter.delegate = self;
[keyVerificationCoordinatorBridgePresenter presentCompleteSecurityFrom:self.presentedViewController isNewSignIn:NO animated:YES];

View file

@ -117,7 +117,6 @@ final class AuthenticationCoordinator: NSObject, AuthenticationCoordinatorProtoc
}
private func presentCompleteSecurity() {
// TODO: handle secure backup required here
guard let session = session else {
MXLog.error("[AuthenticationCoordinator] presentCompleteSecurity: Unable to present security due to missing session.")
authenticationDidComplete()
@ -125,7 +124,8 @@ final class AuthenticationCoordinator: NSObject, AuthenticationCoordinatorProtoc
}
let isNewSignIn = true
let keyVerificationCoordinator = KeyVerificationCoordinator(session: session, flow: .completeSecurity(isNewSignIn), cancellable: true)
let cancellable = !session.vc_homeserverConfiguration().encryption.isSecureBackupRequired
let keyVerificationCoordinator = KeyVerificationCoordinator(session: session, flow: .completeSecurity(isNewSignIn), cancellable: cancellable)
keyVerificationCoordinator.delegate = self
let presentable = keyVerificationCoordinator.toPresentable()

View file

@ -952,6 +952,15 @@
}
self.reviewSessionAlertHasBeenDisplayed = YES;
// Force verification if required by the HS configuration
if (session.vc_homeserverConfiguration.encryption.isSecureBackupRequired)
{
NSLog(@"[MasterTabBarController] presentVerifyCurrentSessionAlertIfNeededWithSession: Force verification of the device");
[[AppDelegate theDelegate] presentCompleteSecurityForSession:session];
return;
}
[self presentVerifyCurrentSessionAlertWithSession:session];
}