diff --git a/iOSClient/Login/NCLogin.swift b/iOSClient/Login/NCLogin.swift index 2ff7d11ade..6b53155078 100644 --- a/iOSClient/Login/NCLogin.swift +++ b/iOSClient/Login/NCLogin.swift @@ -191,6 +191,8 @@ class NCLogin: UIViewController, UITextFieldDelegate, NCLoginQRCodeDelegate { return outgoing } } + + NCNetworking.shared.certificateDelegate = self } override func viewDidAppear(_ animated: Bool) { @@ -493,7 +495,9 @@ extension NCLogin: ClientCertificateDelegate, UIDocumentPickerDelegate { documentProviderMenu.delegate = self self.present(documentProviderMenu, animated: true, completion: nil) })) - present(alertNoCertFound, animated: true) + DispatchQueue.main.async { + self.present(alertNoCertFound, animated: true) + } } func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) { @@ -507,7 +511,9 @@ extension NCLogin: ClientCertificateDelegate, UIDocumentPickerDelegate { alertEnterPassword.addTextField { textField in textField.isSecureTextEntry = true } - present(alertEnterPassword, animated: true) + DispatchQueue.main.async { + self.present(alertEnterPassword, animated: true) + } } func onIncorrectPassword() { @@ -515,7 +521,9 @@ extension NCLogin: ClientCertificateDelegate, UIDocumentPickerDelegate { NCNetworking.shared.p12Password = nil let alertWrongPassword = UIAlertController(title: NSLocalizedString("_client_cert_wrong_password_", comment: ""), message: "", preferredStyle: .alert) alertWrongPassword.addAction(UIAlertAction(title: NSLocalizedString("_ok_", comment: ""), style: .default)) - present(alertWrongPassword, animated: true) + DispatchQueue.main.async { + self.present(alertWrongPassword, animated: true) + } } func poll(loginFlowV2Token: String, loginFlowV2Endpoint: String, loginFlowV2Login: String) { diff --git a/iOSClient/Networking/NCNetworking.swift b/iOSClient/Networking/NCNetworking.swift index bcbd2ef709..66021b1aad 100644 --- a/iOSClient/Networking/NCNetworking.swift +++ b/iOSClient/Networking/NCNetworking.swift @@ -147,7 +147,7 @@ class NCNetworking: NSObject, NextcloudKitDelegate { completionHandler(URLSession.AuthChallengeDisposition.useCredential, creds) } else { self.certificateDelegate?.didAskForClientCertificate() - completionHandler(URLSession.AuthChallengeDisposition.performDefaultHandling, nil) + completionHandler(URLSession.AuthChallengeDisposition.cancelAuthenticationChallenge, nil) } } else { self.checkTrustedChallenge(session, didReceive: challenge, completionHandler: completionHandler)