marinofaggiana 4 years ago
parent
commit
12cfebbe76

+ 1 - 1
Cartfile.resolved

@@ -18,7 +18,7 @@ github "marinofaggiana/AFNetworking" "2967678c3e0e98c9b8d7e06222ad12d1f49c26f2"
 github "marinofaggiana/KTVHTTPCache" "2.0.2"
 github "marinofaggiana/TOPasscodeViewController" "0.0.6"
 github "marinofaggiana/XLForm" "eb9381ad8129f60402bf412250fb31b95a628a08"
-github "nextcloud/ios-communication-library" "b6a3a70320495526f3648e8720d665f437615686"
+github "nextcloud/ios-communication-library" "ea8e7efdac21aae1e613bcc6eb9c27b1c7235fd9"
 github "realm/realm-cocoa" "v4.4.1"
 github "rechsteiner/Parchment" "v1.7.0"
 github "scenee/FloatingPanel" "v1.7.4"

+ 13 - 7
iOSClient/Networking/CCNetworking.m

@@ -511,11 +511,14 @@
             
         } else {
             
-            if (metadata && (errorCode == kOCErrorServerUnauthorized || errorCode == kOCErrorServerForbidden))
-                [[OCNetworking sharedManager] checkRemoteUser:metadata.account function:@"download" errorCode:errorCode];
-            else if (metadata && errorCode == NSURLErrorServerCertificateUntrusted)
+            if (metadata && (errorCode == kOCErrorServerUnauthorized || errorCode == kOCErrorServerForbidden)) {
+#ifndef EXTENSION
+                [[NCNetworkingCheckRemoteUser shared] checkRemoteUserWithAccount:metadata.account];
+#endif
+            } else if (metadata && errorCode == NSURLErrorServerCertificateUntrusted) {
                 [CCUtility setCertificateError:metadata.account error:YES];
-
+            }
+            
             [[NCManageDatabase sharedInstance] setMetadataSession:nil sessionError:[CCError manageErrorKCF:errorCode withNumberError:NO] sessionSelector:nil sessionTaskIdentifier:k_taskIdentifierDone status:k_metadataStatusDownloadError predicate:[NSPredicate predicateWithFormat:@"ocId == %@", ocId]];
         }
         
@@ -944,10 +947,13 @@
             
         } else {
 
-            if (metadata && (errorCode == kOCErrorServerUnauthorized || errorCode == kOCErrorServerForbidden))
-                [[OCNetworking sharedManager] checkRemoteUser:metadata.account function:@"upload" errorCode:errorCode];
-            else if (metadata && errorCode == NSURLErrorServerCertificateUntrusted)
+            if (metadata && (errorCode == kOCErrorServerUnauthorized || errorCode == kOCErrorServerForbidden)) {
+#ifndef EXTENSION
+                [[NCNetworkingCheckRemoteUser shared] checkRemoteUserWithAccount:metadata.account];
+#endif
+            } else if (metadata && errorCode == NSURLErrorServerCertificateUntrusted) {
                 [CCUtility setCertificateError:metadata.account error:YES];
+            }
             
             [[NCManageDatabase sharedInstance] setMetadataSession:nil sessionError:[CCError manageErrorKCF:errorCode withNumberError:NO] sessionSelector:nil sessionTaskIdentifier:k_taskIdentifierDone status:k_metadataStatusUploadError predicate:[NSPredicate predicateWithFormat:@"ocId == %@", tempocId]];
             

+ 2 - 3
iOSClient/Networking/NCNetworkingCheckRemoteUser.swift

@@ -32,7 +32,7 @@ import NCCommunication
     let appDelegate = UIApplication.shared.delegate as! AppDelegate
     var checkRemoteUserInProgress = false
 
-    @objc func checkRemoteUser(account: String, function: String, errorCode: Int) {
+    @objc func checkRemoteUser(account: String) {
            
         if self.checkRemoteUserInProgress {
             return;
@@ -71,10 +71,9 @@ import NCCommunication
                
             if UIApplication.shared.applicationState == .active && appDelegate.reachability.isReachable() {
                 let description = String.localizedStringWithFormat(NSLocalizedString("_error_check_remote_user_", comment: ""), tableAccount.user, tableAccount.url)
-                NCContentPresenter.shared.messageNotification("_error_", description: description, delay: TimeInterval(k_dismissAfterSecond*2), type: NCContentPresenter.messageType.error, errorCode: errorCode)
+                NCContentPresenter.shared.messageNotification("_error_", description: description, delay: TimeInterval(k_dismissAfterSecond*2), type: NCContentPresenter.messageType.error, errorCode: 403)
                 CCUtility.setPassword(account, password: nil)
             }
         }
-           
     }
 }

+ 2 - 2
iOSClient/Networking/NCService.swift

@@ -114,7 +114,7 @@ class NCService: NSObject {
             } else {
                 
                 if errorCode == kOCErrorServerUnauthorized || errorCode == kOCErrorServerForbidden {
-                    OCNetworking.sharedManager()?.checkRemoteUser(account, function: "get user profile", errorCode: errorCode)
+                    NCNetworkingCheckRemoteUser.shared.checkRemoteUser(account: account)
                 }
                 
                 print("[LOG] It has been changed user during networking process, error.")
@@ -206,7 +206,7 @@ class NCService: NSObject {
                 self.appDelegate.settingThemingColorBrand()
                 
                 if errorCode == kOCErrorServerUnauthorized || errorCode == kOCErrorServerForbidden {
-                    OCNetworking.sharedManager()?.checkRemoteUser(account, function: "get capabilities", errorCode: errorCode)
+                    NCNetworkingCheckRemoteUser.shared.checkRemoteUser(account: account)
                 }
                 
             } else {

+ 0 - 15
iOSClient/Networking/OCNetworking.h

@@ -38,8 +38,6 @@
 #pragma mark ===== Server =====
 
 - (void)checkServerUrl:(NSString *)serverUrl user:(NSString *)user userID:(NSString *)userID password:(NSString *)password completion:(void (^)(NSString *message, NSInteger errorCode))completion;
-//- (void)serverStatusUrl:(NSString *)serverUrl completion:(void(^)(NSString *serverProductName, NSInteger versionMajor, NSInteger versionMicro, NSInteger versionMinor, BOOL extendedSupport, NSString *message, NSInteger errorCode))completion;
-//- (void)downloadContentsOfUrl:(NSString *)serverUrl completion:(void(^)(NSData *data, NSString *message, NSInteger errorCode))completion;
 - (void)getAppPassword:(NSString *)serverUrl username:(NSString *)username password:(NSString *)password completion:(void(^)(NSString *token, NSString *message, NSInteger errorCode))completion;
 
 #pragma mark ===== Download / Upload =====
@@ -48,12 +46,6 @@
 - (NSURLSessionTask *)downloadWithAccount:(NSString *)account url:(NSString *)url fileNameLocalPath:(NSString *)fileNameLocalPath encode:(BOOL)encode completion:(void (^)(NSString *account, NSString *message, NSInteger errorCode))completion;
 - (NSURLSessionTask *)uploadWithAccount:(NSString *)account fileNameServerUrl:(NSString *)fileNameServerUrl fileNameLocalPath:(NSString *)fileNameLocalPath encode:(BOOL)encode communication:(OCCommunication *)communication progress:(void(^)(NSProgress *progress))uploadProgress completion:(void(^)(NSString *account, NSString *ocId, NSString *etag, NSDate *date, NSString *message, NSInteger errorCode))completion;
 
-#pragma mark ===== WebDav =====
-
-//- (void)readFileWithAccount:(NSString *)account serverUrl:(NSString *)serverUrl fileName:(NSString *)fileName completion:(void(^)(NSString *account, tableMetadata *metadata, NSString *message, NSInteger errorCode))completion;
-
-//- (void)readFolderWithAccount:(NSString *)account serverUrl:(NSString *)serverUrl depth:(NSString *)depth completion:(void(^)(NSString *account, NSArray *metadatas, tableMetadata *metadataFolder, NSString *message, NSInteger errorCode))completion;
-
 #pragma mark ===== Share =====
 
 - (void)readShareWithAccount:(NSString *)account completion:(void (^)(NSString *account, NSArray *items, NSString *message, NSInteger errorCode))completion;
@@ -85,13 +77,6 @@
 - (void)createNewRichdocumentsWithAccount:(NSString *)account fileName:(NSString *)fileName serverUrl:(NSString *)serverUrl templateID:(NSString *)templateID completion:(void(^)(NSString *account, NSString *url, NSString *message, NSInteger errorCode))completion;
 - (void)createAssetRichdocumentsWithAccount:(NSString *)account fileName:(NSString *)fileName serverUrl:(NSString *)serverUrl completion:(void(^)(NSString *account, NSString *link, NSString *message, NSInteger errorCode))completion;
 
-#pragma mark ===== Full Text Search =====
-
-- (void)fullTextSearchWithAccount:(NSString *)account text:(NSString *)text page:(NSInteger)page completion:(void(^)(NSString *account, NSArray *items, NSString *message, NSInteger errorCode))completion;
-
-#pragma mark ===== Check remote user =====
-
-- (void)checkRemoteUser:(NSString *)account function:(NSString *)function errorCode:(NSInteger)errorCode;
 
 #pragma mark ===== Trash =====
 

+ 30 - 195
iOSClient/Networking/OCNetworking.m

@@ -382,7 +382,9 @@
         
         // Server Unauthorized
         if (errorCode == kOCErrorServerUnauthorized || errorCode == kOCErrorServerForbidden) {
-            [[OCNetworking sharedManager] checkRemoteUser:account function:@"download" errorCode:errorCode];
+#ifndef EXTENSION
+                [[NCNetworkingCheckRemoteUser shared] checkRemoteUserWithAccount:account];
+#endif
         } else if (errorCode == NSURLErrorServerCertificateUntrusted) {
             [CCUtility setCertificateError:account error:YES];
         }
@@ -431,7 +433,9 @@
         
         // Server Unauthorized
         if (errorCode == kOCErrorServerUnauthorized || errorCode == kOCErrorServerForbidden) {
-            [[OCNetworking sharedManager] checkRemoteUser:account function:@"download" errorCode:errorCode];
+#ifndef EXTENSION
+            [[NCNetworkingCheckRemoteUser shared] checkRemoteUserWithAccount:account];
+#endif
         } else if (errorCode == NSURLErrorServerCertificateUntrusted) {
             [CCUtility setCertificateError:account error:YES];
         }
@@ -485,7 +489,9 @@
         
         // Server Unauthorized
         if (errorCode == kOCErrorServerUnauthorized || errorCode == kOCErrorServerForbidden) {
-            [[OCNetworking sharedManager] checkRemoteUser:account function:@"upload" errorCode:errorCode];
+#ifndef EXTENSION
+            [[NCNetworkingCheckRemoteUser shared] checkRemoteUserWithAccount:account];
+#endif
         } else if (errorCode == NSURLErrorServerCertificateUntrusted) {
             [CCUtility setCertificateError:account error:YES];
         }
@@ -1008,7 +1014,9 @@
         
         // Server Unauthorized
         if (errorCode == kOCErrorServerUnauthorized || errorCode == kOCErrorServerForbidden) {
-            [[OCNetworking sharedManager] checkRemoteUser:account function:@"get activity" errorCode:errorCode];
+#ifndef EXTENSION
+            [[NCNetworkingCheckRemoteUser shared] checkRemoteUserWithAccount:account];
+#endif
         } else if (errorCode == NSURLErrorServerCertificateUntrusted) {
             [CCUtility setCertificateError:account error:YES];
         }
@@ -1052,7 +1060,9 @@
         
         // Server Unauthorized
         if (errorCode == kOCErrorServerUnauthorized || errorCode == kOCErrorServerForbidden) {
-            [[OCNetworking sharedManager] checkRemoteUser:account function:@"get external sites" errorCode:errorCode];
+#ifndef EXTENSION
+            [[NCNetworkingCheckRemoteUser shared] checkRemoteUserWithAccount:account];
+#endif
         } else if (errorCode == NSURLErrorServerCertificateUntrusted) {
             [CCUtility setCertificateError:account error:YES];
         }
@@ -1097,7 +1107,9 @@
         
         // Server Unauthorized
         if (errorCode == kOCErrorServerUnauthorized || errorCode == kOCErrorServerForbidden) {
-            [[OCNetworking sharedManager] checkRemoteUser:account function:@"get notification" errorCode:errorCode];
+#ifndef EXTENSION
+            [[NCNetworkingCheckRemoteUser shared] checkRemoteUserWithAccount:account];
+#endif
         } else if (errorCode == NSURLErrorServerCertificateUntrusted) {
             [CCUtility setCertificateError:account error:YES];
         }
@@ -1142,7 +1154,9 @@
         
         // Server Unauthorized
         if (errorCode == kOCErrorServerUnauthorized || errorCode == kOCErrorServerForbidden) {
-            [[OCNetworking sharedManager] checkRemoteUser:account function:@"set notification" errorCode:errorCode];
+#ifndef EXTENSION
+            [[NCNetworkingCheckRemoteUser shared] checkRemoteUserWithAccount:account];
+#endif
         } else if (errorCode == NSURLErrorServerCertificateUntrusted) {
             [CCUtility setCertificateError:account error:YES];
         }
@@ -1538,191 +1552,6 @@
     }];
 }
 
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ===== Full Text Search =====
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)fullTextSearchWithAccount:(NSString *)account text:(NSString *)text page:(NSInteger)page completion:(void(^)(NSString *account, NSArray *items, NSString *message, NSInteger errorCode))completion
-{
-    tableAccount *tableAccount = [[NCManageDatabase sharedInstance] getAccountWithPredicate:[NSPredicate predicateWithFormat:@"account == %@", account]];
-    if (tableAccount == nil) {
-        completion(account, nil, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
-    } else if ([CCUtility getPassword:account].length == 0) {
-        completion(account, nil, NSLocalizedString(@"_bad_username_password_", nil), kOCErrorServerUnauthorized);
-    } else if ([CCUtility getCertificateError:account]) {
-        completion(account, nil, NSLocalizedString(@"_ssl_certificate_untrusted_", nil), NSURLErrorServerCertificateUntrusted);
-    }
-    
-    // Create JSON
-    NSMutableDictionary *dataDic = [NSMutableDictionary new];
-    [dataDic setValue:@"files" forKey:@"providers"];
-    [dataDic setValue:text forKey:@"search"];
-    [dataDic setValue:[NSNumber numberWithInteger:page] forKey:@"page"];
-    [dataDic setValue:[NSNumber numberWithInt:20] forKey:@"size"];
-    
-    NSMutableDictionary *options = [NSMutableDictionary new];
-    [options setValue:@"" forKey:@"files_within_dir"];
-    [options setValue:@"" forKey:@"files_local"];
-    [options setValue:@"" forKey:@"files_extension"];
-    
-    [dataDic setValue:options forKey:@"options"];
-    
-    NSString *data = [[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:dataDic options:0 error:nil] encoding:NSUTF8StringEncoding];
-    
-    OCCommunication *communication = [OCNetworking sharedManager].sharedOCCommunication;
-    
-    [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:[CCUtility getPassword:account]];
-    [communication setUserAgent:[CCUtility getUserAgent]];
-    [communication fullTextSearch:[tableAccount.url stringByAppendingString:@"/"] data:data onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer) {
-        
-        completion(account, items, nil, 0);
-
-    } failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
-        
-        NSString *message;
-        NSInteger errorCode = response.statusCode;
-        
-        if (errorCode == 0 || (errorCode >= 200 && errorCode < 300))
-            errorCode = error.code;
-        
-        // Error
-        if (errorCode == 503)
-            message = NSLocalizedString(@"_server_error_retry_", nil);
-        else
-            message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
-        
-        completion(account, nil, message, errorCode);
-    }];
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ===== Check remote user =====
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)checkRemoteUser:(NSString *)account function:(NSString *)function errorCode:(NSInteger)errorCode
-{
- #ifndef EXTENSION
-    @synchronized(self) {
-        
-        AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
-        NSInteger serverVersionMajor = [[NCManageDatabase sharedInstance] getCapabilitiesServerIntWithAccount:account elements:NCElementsJSON.shared.capabilitiesVersionMajor];
-        tableAccount *tableAccount = [[NCManageDatabase sharedInstance] getAccountWithPredicate:[NSPredicate predicateWithFormat:@"account == %@", account]];
-        NSString *token = [CCUtility getPassword:account];
-        
-        if (self.checkRemoteUserInProgress || tableAccount == nil || token == nil) {
-            return;
-        } else {
-            self.checkRemoteUserInProgress = true;
-        }
-        
-        if (serverVersionMajor >= k_nextcloud_version_17_0) {
-            
-            [[OCNetworking sharedManager] getRemoteWipeStatusWithAccount:account token:token completion:^(NSString *account, BOOL wipe, NSString *message, NSInteger errorCode) {
-                
-                if (wipe) {
-                    
-                    [appDelegate deleteAccount:account wipe:true];
-                    [[NCContentPresenter shared] messageNotification:tableAccount.user description:@"_wipe_account_" delay:k_dismissAfterSecond type:messageTypeError errorCode:k_CCErrorInternalError];
-                    [[OCNetworking sharedManager] setRemoteWipeCompletitionWithUser:tableAccount.user userID:tableAccount.userID url:tableAccount.url token:token completion:^(NSString *message, NSInteger errorCode) {
-                        NSLog(@"Wiped");
-                    }];
-                    
-                } else {
-                    
-                    if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive && [appDelegate.reachability isReachable]) {
-                        NSString *description = [NSString stringWithFormat: NSLocalizedString(@"_error_check_remote_user_", nil), tableAccount.user, tableAccount.url];
-                        [[NCContentPresenter shared] messageNotification:@"_error_" description:description delay:k_dismissAfterSecond*2 type:messageTypeError errorCode:errorCode];
-                        [CCUtility setPassword:account password:nil];
-                    }
-                }
-                
-                self.checkRemoteUserInProgress = false;
-            }];
-            
-        } else if ([CCUtility getPassword:account] != nil) {
-            
-            if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive && [appDelegate.reachability isReachable]) {
-                NSString *description = [NSString stringWithFormat: NSLocalizedString(@"_error_check_remote_user_", nil), tableAccount.user, tableAccount.url];
-                [[NCContentPresenter shared] messageNotification:@"_error_" description:description delay:k_dismissAfterSecond*2 type:messageTypeError errorCode:errorCode];
-                [CCUtility setPassword:account password:nil];
-            }
-        }
-    }
-#endif
-}
-
-- (void)getRemoteWipeStatusWithAccount:(NSString *)account token:(NSString *)token completion:(void(^)(NSString *account, BOOL wipe, NSString *message, NSInteger errorCode))completion
-{
-    tableAccount *tableAccount = [[NCManageDatabase sharedInstance] getAccountWithPredicate:[NSPredicate predicateWithFormat:@"account == %@", account]];
-    if (tableAccount == nil) {
-        completion(account, false, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
-    } else if ([CCUtility getPassword:account].length == 0) {
-        completion(account, false, NSLocalizedString(@"_bad_username_password_", nil), kOCErrorServerUnauthorized);
-    } else if ([CCUtility getCertificateError:account]) {
-        completion(account, false, NSLocalizedString(@"_ssl_certificate_untrusted_", nil), NSURLErrorServerCertificateUntrusted);
-    }
-    
-    OCCommunication *communication = [OCNetworking sharedManager].sharedOCCommunication;
-    
-    [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:[CCUtility getPassword:account]];
-    [communication setUserAgent:[CCUtility getUserAgent]];
-    [communication getRemoteWipeStatus:tableAccount.url token:token onCommunication:communication successRequest:^(NSHTTPURLResponse *response, BOOL wipe, NSString *redirectedServer) {
-        
-        completion(account, wipe, nil, 0);
-        
-    } failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
-        
-        NSString *message;
-        NSInteger errorCode = response.statusCode;
-        
-        if (errorCode == 0 || (errorCode >= 200 && errorCode < 300))
-            errorCode = error.code;
-        
-        // Server Unauthorized
-        if (errorCode == kOCErrorServerUnauthorized || errorCode == kOCErrorServerForbidden) {
-            [[OCNetworking sharedManager] checkRemoteUser:account function:@"get remote wipe status" errorCode:errorCode];
-        } else if (errorCode == NSURLErrorServerCertificateUntrusted) {
-            [CCUtility setCertificateError:account error:YES];
-        }
-        
-        // Error
-        if (errorCode == 503)
-            message = NSLocalizedString(@"_server_error_retry_", nil);
-        else
-            message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
-        
-        completion(account, false, message, errorCode);
-    }];
-}
-
-- (void)setRemoteWipeCompletitionWithUser:(NSString *)user userID:(NSString *)userID url:(NSString *)url token:(NSString *)token completion:(void(^)(NSString *message, NSInteger errorCode))completion
-{
-    OCCommunication *communication = [OCNetworking sharedManager].sharedOCCommunication;
-    
-    [communication setCredentialsWithUser:user andUserID:userID andPassword:token];
-    [communication setUserAgent:[CCUtility getUserAgent]];
-    [communication setRemoteWipeCompletition:url token:token onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
-        
-        completion(nil, 0);
-
-    } failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
-        
-        NSString *message;
-        NSInteger errorCode = response.statusCode;
-        
-        if (errorCode == 0 || (errorCode >= 200 && errorCode < 300))
-            errorCode = error.code;
-        
-        // Error
-        if (errorCode == 503)
-            message = NSLocalizedString(@"_server_error_retry_", nil);
-        else
-            message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
-        
-        completion(message, errorCode);
-    }];
-}
-
 #pragma --------------------------------------------------------------------------------------------
 #pragma mark ===== Trash =====
 #pragma --------------------------------------------------------------------------------------------
@@ -2078,7 +1907,9 @@
         
         // Server Unauthorized
         if (errorCode == kOCErrorServerUnauthorized || errorCode == kOCErrorServerForbidden) {
-            [[OCNetworking sharedManager] checkRemoteUser:account function:@"get user profile" errorCode:errorCode];
+#ifndef EXTENSION
+            [[NCNetworkingCheckRemoteUser shared] checkRemoteUserWithAccount:account];
+#endif
         } else if (errorCode == NSURLErrorServerCertificateUntrusted) {
             [CCUtility setCertificateError:account error:YES];
         }
@@ -2152,7 +1983,9 @@
         
         // Server Unauthorized
         if (errorCode == kOCErrorServerUnauthorized || errorCode == kOCErrorServerForbidden) {
-            [[OCNetworking sharedManager] checkRemoteUser:account function:@"put user profile" errorCode:errorCode];
+#ifndef EXTENSION
+            [[NCNetworkingCheckRemoteUser shared] checkRemoteUserWithAccount:account];
+#endif
         } else if (errorCode == NSURLErrorServerCertificateUntrusted) {
             [CCUtility setCertificateError:account error:YES];
         }
@@ -2199,7 +2032,9 @@
         
         // Server Unauthorized
         if (errorCode == kOCErrorServerUnauthorized || errorCode == kOCErrorServerForbidden) {
-            [[OCNetworking sharedManager] checkRemoteUser:account function:@"get features" errorCode:errorCode];
+#ifndef EXTENSION
+            [[NCNetworkingCheckRemoteUser shared] checkRemoteUserWithAccount:account];
+#endif
         } else if (errorCode == NSURLErrorServerCertificateUntrusted) {
             [CCUtility setCertificateError:account error:YES];
         }