|
@@ -270,25 +270,33 @@ class NCLogin: UIViewController, UITextFieldDelegate, NCLoginQRCodeDelegate {
|
|
|
// Login Flow V2
|
|
|
if errorCode == 0 && NCBrandOptions.shared.use_loginflowv2 && token != nil && endpoint != nil && login != nil {
|
|
|
|
|
|
- if let loginWeb = UIStoryboard(name: "NCLogin", bundle: nil).instantiateViewController(withIdentifier: "NCLoginWeb") as? NCLoginWeb {
|
|
|
-
|
|
|
- loginWeb.urlBase = url
|
|
|
- loginWeb.loginFlowV2Available = true
|
|
|
- loginWeb.loginFlowV2Token = token!
|
|
|
- loginWeb.loginFlowV2Endpoint = endpoint!
|
|
|
- loginWeb.loginFlowV2Login = login!
|
|
|
-
|
|
|
- self.navigationController?.pushViewController(loginWeb, animated: true)
|
|
|
+ self.checkPushNotificationServerProxy { error in
|
|
|
+ if !error {
|
|
|
+ if let loginWeb = UIStoryboard(name: "NCLogin", bundle: nil).instantiateViewController(withIdentifier: "NCLoginWeb") as? NCLoginWeb {
|
|
|
+
|
|
|
+ loginWeb.urlBase = url
|
|
|
+ loginWeb.loginFlowV2Available = true
|
|
|
+ loginWeb.loginFlowV2Token = token!
|
|
|
+ loginWeb.loginFlowV2Endpoint = endpoint!
|
|
|
+ loginWeb.loginFlowV2Login = login!
|
|
|
+
|
|
|
+ self.navigationController?.pushViewController(loginWeb, animated: true)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// Login Flow
|
|
|
} else if versionMajor >= NCGlobal.shared.nextcloudVersion12 {
|
|
|
|
|
|
- if let loginWeb = UIStoryboard(name: "NCLogin", bundle: nil).instantiateViewController(withIdentifier: "NCLoginWeb") as? NCLoginWeb {
|
|
|
-
|
|
|
- loginWeb.urlBase = url
|
|
|
+ self.checkPushNotificationServerProxy { error in
|
|
|
+ if !error {
|
|
|
+ if let loginWeb = UIStoryboard(name: "NCLogin", bundle: nil).instantiateViewController(withIdentifier: "NCLoginWeb") as? NCLoginWeb {
|
|
|
+
|
|
|
+ loginWeb.urlBase = url
|
|
|
|
|
|
- self.navigationController?.pushViewController(loginWeb, animated: true)
|
|
|
+ self.navigationController?.pushViewController(loginWeb, animated: true)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// NO Login flow available
|
|
@@ -461,4 +469,48 @@ class NCLogin: UIViewController, UITextFieldDelegate, NCLoginQRCodeDelegate {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ // MARK: -
|
|
|
+
|
|
|
+ func checkPushNotificationServerProxy(completion: @escaping (_ error: Bool)->()) {
|
|
|
+
|
|
|
+ let url = NCBrandOptions.shared.pushNotificationServerProxy
|
|
|
+
|
|
|
+ NCCommunication.shared.checkServer(serverUrl: url) { (errorCode, errorDescription) in
|
|
|
+
|
|
|
+ if errorCode == 0 {
|
|
|
+
|
|
|
+ completion(false)
|
|
|
+
|
|
|
+ } else if errorCode == NSURLErrorServerCertificateUntrusted {
|
|
|
+
|
|
|
+ let alertController = UIAlertController(title: NSLocalizedString("_ssl_certificate_untrusted_", comment: ""), message: NSLocalizedString("_connect_server_anyway_", comment: ""), preferredStyle: .alert)
|
|
|
+
|
|
|
+ alertController.addAction(UIAlertAction(title: NSLocalizedString("_yes_", comment: ""), style: .default, handler: { action in
|
|
|
+ if let host = URL(string: url)?.host {
|
|
|
+ NCNetworking.shared.writeCertificate(host: host)
|
|
|
+ }
|
|
|
+ self.appDelegate.startTimerErrorNetworking()
|
|
|
+ completion(false)
|
|
|
+ }))
|
|
|
+
|
|
|
+ alertController.addAction(UIAlertAction(title: NSLocalizedString("_no_", comment: ""), style: .default, handler: { action in
|
|
|
+ self.appDelegate.startTimerErrorNetworking()
|
|
|
+ completion(true)
|
|
|
+ }))
|
|
|
+
|
|
|
+ alertController.addAction(UIAlertAction(title: NSLocalizedString("_certificate_details_", comment: ""), style: .default, handler: { action in
|
|
|
+ if let navigationController = UIStoryboard(name: "NCViewCertificateDetails", bundle: nil).instantiateInitialViewController() {
|
|
|
+ self.present(navigationController, animated: true)
|
|
|
+ }
|
|
|
+ }))
|
|
|
+
|
|
|
+ self.present(alertController, animated: true, completion: {
|
|
|
+ self.appDelegate.timerErrorNetworking?.invalidate()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|