Marino Faggiana 8 yıl önce
ebeveyn
işleme
81e7efa195

+ 6 - 12
Nextcloud.xcodeproj/project.pbxproj

@@ -247,7 +247,6 @@
 		F77B0E131D118A16002130FE /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = F7A582D61A24DAB500E903D7 /* AppDelegate.m */; };
 		F77B0E141D118A16002130FE /* CCError.m in Sources */ = {isa = PBXBuildFile; fileRef = F76C3B881C638A4C00DC4301 /* CCError.m */; };
 		F77B0E161D118A16002130FE /* AFViewShaker.m in Sources */ = {isa = PBXBuildFile; fileRef = F70F02B41C889183008DAB36 /* AFViewShaker.m */; };
-		F77B0E181D118A16002130FE /* CCLogin.m in Sources */ = {isa = PBXBuildFile; fileRef = F757D2A71BB3E7C40031FDD7 /* CCLogin.m */; };
 		F77B0E1B1D118A16002130FE /* CCGraphics.m in Sources */ = {isa = PBXBuildFile; fileRef = F76C3B841C6388BC00DC4301 /* CCGraphics.m */; };
 		F77B0E1C1D118A16002130FE /* BKPasscodeDummyViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F70F02C01C889183008DAB36 /* BKPasscodeDummyViewController.m */; };
 		F77B0E1D1D118A16002130FE /* ReaderThumbQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = F70F0ECC1C889317008DAB36 /* ReaderThumbQueue.m */; };
@@ -533,7 +532,7 @@
 		F7BB14961D5B62C000ECEE68 /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F70A63061D5B3467004E2AA5 /* libcrypto.a */; };
 		F7BB14971D5B62C000ECEE68 /* libssl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F70A63071D5B3467004E2AA5 /* libssl.a */; };
 		F7BE6E2F1D2D5C3B00106933 /* CCQuickActions.m in Sources */ = {isa = PBXBuildFile; fileRef = F7BE6E2C1D2D5C3B00106933 /* CCQuickActions.m */; };
-		F7BF1B431D51E893000854F6 /* CCLoginNCOC.m in Sources */ = {isa = PBXBuildFile; fileRef = F7BF1B401D51E893000854F6 /* CCLoginNCOC.m */; };
+		F7BF1B431D51E893000854F6 /* CCLogin.m in Sources */ = {isa = PBXBuildFile; fileRef = F7BF1B401D51E893000854F6 /* CCLogin.m */; };
 		F7C00D471E2D0D0F0032160B /* CCCellOffline.m in Sources */ = {isa = PBXBuildFile; fileRef = F7C00D431E2D0D0F0032160B /* CCCellOffline.m */; };
 		F7C00D481E2D0D0F0032160B /* CCCellOffline.xib in Resources */ = {isa = PBXBuildFile; fileRef = F7C00D441E2D0D0F0032160B /* CCCellOffline.xib */; };
 		F7C00D491E2D0D0F0032160B /* CCOffline.m in Sources */ = {isa = PBXBuildFile; fileRef = F7C00D461E2D0D0F0032160B /* CCOffline.m */; };
@@ -1292,8 +1291,6 @@
 		F7540F2A1D5B238600C3FFA8 /* x509.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = x509.h; sourceTree = "<group>"; };
 		F7540F2B1D5B238600C3FFA8 /* x509_vfy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = x509_vfy.h; sourceTree = "<group>"; };
 		F7540F2C1D5B238600C3FFA8 /* x509v3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = x509v3.h; sourceTree = "<group>"; };
-		F757D2A61BB3E7C40031FDD7 /* CCLogin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCLogin.h; sourceTree = "<group>"; };
-		F757D2A71BB3E7C40031FDD7 /* CCLogin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCLogin.m; sourceTree = "<group>"; };
 		F7596C771D128FC80092A6B8 /* Nextcloud.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Nextcloud.xcassets; sourceTree = "<group>"; };
 		F75ADF441DC75FFE008A7347 /* CCLogin.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = CCLogin.storyboard; sourceTree = "<group>"; };
 		F75CDBF51DF063AD00116AD0 /* .gitignore */ = {isa = PBXFileReference; lastKnownFileType = text; name = .gitignore; path = ../.gitignore; sourceTree = "<group>"; };
@@ -1425,8 +1422,8 @@
 		F7B81D801C64E77F006D02DF /* CCCoreData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCCoreData.m; sourceTree = "<group>"; };
 		F7BE6E2B1D2D5C3B00106933 /* CCQuickActions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCQuickActions.h; sourceTree = "<group>"; };
 		F7BE6E2C1D2D5C3B00106933 /* CCQuickActions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCQuickActions.m; sourceTree = "<group>"; };
-		F7BF1B3F1D51E893000854F6 /* CCLoginNCOC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCLoginNCOC.h; sourceTree = "<group>"; };
-		F7BF1B401D51E893000854F6 /* CCLoginNCOC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCLoginNCOC.m; sourceTree = "<group>"; };
+		F7BF1B3F1D51E893000854F6 /* CCLogin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCLogin.h; sourceTree = "<group>"; };
+		F7BF1B401D51E893000854F6 /* CCLogin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCLogin.m; sourceTree = "<group>"; };
 		F7BFA4541E0693EE0010E44C /* cryptocloud 5.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "cryptocloud 5.xcdatamodel"; sourceTree = "<group>"; };
 		F7BFCCBE1B68C21900548E76 /* CCManageAsset.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCManageAsset.h; sourceTree = "<group>"; };
 		F7BFCCBF1B68C21900548E76 /* CCManageAsset.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCManageAsset.m; sourceTree = "<group>"; };
@@ -2925,10 +2922,8 @@
 			isa = PBXGroup;
 			children = (
 				F75ADF441DC75FFE008A7347 /* CCLogin.storyboard */,
-				F757D2A61BB3E7C40031FDD7 /* CCLogin.h */,
-				F757D2A71BB3E7C40031FDD7 /* CCLogin.m */,
-				F7BF1B3F1D51E893000854F6 /* CCLoginNCOC.h */,
-				F7BF1B401D51E893000854F6 /* CCLoginNCOC.m */,
+				F7BF1B3F1D51E893000854F6 /* CCLogin.h */,
+				F7BF1B401D51E893000854F6 /* CCLogin.m */,
 				F7388E261CB27FE40031C19C /* CCSecurityOptions.h */,
 				F7388E271CB27FE40031C19C /* CCSecurityOptions.m */,
 			);
@@ -3928,7 +3923,6 @@
 				F73CCE191DC13776007E38D8 /* XLFormRegexValidator.m in Sources */,
 				F7F06E951DBFACC600099AE9 /* PHAsset+CTAssetsPickerController.m in Sources */,
 				F77B0E161D118A16002130FE /* AFViewShaker.m in Sources */,
-				F77B0E181D118A16002130FE /* CCLogin.m in Sources */,
 				F77B0E1B1D118A16002130FE /* CCGraphics.m in Sources */,
 				F73CCE071DC13776007E38D8 /* NSExpression+XLFormAdditions.m in Sources */,
 				F77B0E1C1D118A16002130FE /* BKPasscodeDummyViewController.m in Sources */,
@@ -4043,7 +4037,7 @@
 				F77B0E7B1D118A16002130FE /* CCPassaporto.m in Sources */,
 				F7F06EA51DBFACC600099AE9 /* CTAssetItemViewController.m in Sources */,
 				F7659A5A1DC0B760004860C4 /* PSTCollectionView.m in Sources */,
-				F7BF1B431D51E893000854F6 /* CCLoginNCOC.m in Sources */,
+				F7BF1B431D51E893000854F6 /* CCLogin.m in Sources */,
 				F77B0E7D1D118A16002130FE /* CYRTextStorage.m in Sources */,
 				F77B0E7E1D118A16002130FE /* ThumbsViewController.m in Sources */,
 				F77B0E801D118A16002130FE /* ZSSRichTextEditor.m in Sources */,

+ 13 - 1
Picker/DocumentPickerViewController.swift

@@ -138,7 +138,19 @@ class DocumentPickerViewController: UIDocumentPickerExtensionViewController, CCN
         self.tableView.separatorColor = UIColor(colorLiteralRed: 153.0/255.0, green: 153.0/255.0, blue: 153.0/255.0, alpha: 0.2)
         self.tableView.tableFooterView = UIView()
         
-        // Crypto Cloud Mode
+        // Get Crypto Cloud Mode
+        let password = CCUtility.getKeyChainPasscode(forUUID: CCUtility.getUUID())
+        
+        if password?.characters.count == 0 {
+            
+            isCryptoCloudMode = false
+            
+        } else {
+            
+            isCryptoCloudMode = true
+        }
+        
+        // Managed Crypto Cloud Mode
         if isCryptoCloudMode == true {
             
             // Encrypted mode

+ 20 - 13
iOSClient/Login/CCLogin.h

@@ -2,7 +2,7 @@
 //  CCLogin.h
 //  Crypto Cloud Technology Nextcloud
 //
-//  Created by Marino Faggiana on 11/09/14.
+//  Created by Marino Faggiana on 09/04/15.
 //  Copyright (c) 2014 TWS. All rights reserved.
 //
 //  Author Marino Faggiana <m.faggiana@twsweb.it>
@@ -22,22 +22,29 @@
 //
 
 #import <UIKit/UIKit.h>
-#import <Foundation/Foundation.h>
 
-#import "CCIntro.h"
-#import "CCUtility.h"
-#import "CCLoginNCOC.h"
-#import "CCBKPasscode.h"
-#import "CCSecurityOptions.h"
+#import "UIImage+animatedGIF.h"
+#import "CCCertificate.h"
+#import "OCNetworking.h"
 
-@interface CCLogin : UIViewController <BKPasscodeViewControllerDelegate, CCIntroDelegate, CCSecurityOptionsDelegate>
+@interface CCLogin : UIViewController <UITextFieldDelegate, NSURLSessionTaskDelegate, NSURLSessionDelegate, CCCertificateDelegate, OCNetworkingDelegate>
 
-@property NSUInteger failedAttempts;
-@property (nonatomic, strong) NSDate *lockUntilDate;
+{
+    UIAlertView *alertView;
+    UIView *rootView;
+}
 
-@property (nonatomic, weak) IBOutlet UIImageView *brand;
-@property (nonatomic, weak) IBOutlet UIButton *nextcloud;
+@property (nonatomic, weak) IBOutlet UITextField *user;
+@property (nonatomic, weak) IBOutlet UITextField *password;
+@property (nonatomic, weak) IBOutlet UITextField *baseUrl;
+@property (nonatomic, weak) IBOutlet UIImageView *loadingBaseUrl;
 
-@property (nonatomic, strong) CCIntro *intro;
+@property (nonatomic, weak) IBOutlet UIButton *login;
+@property (nonatomic, weak) IBOutlet UIButton *annulla;
+@property (nonatomic, weak) IBOutlet UIButton *toggleVisiblePassword;
+
+@property BOOL modifyOnlyPassword;
+@property (nonatomic, strong) NSString *typeCloud;
+@property (nonatomic, strong) UIViewController *viewController;
 
 @end

+ 183 - 175
iOSClient/Login/CCLogin.m

@@ -2,7 +2,7 @@
 //  CCLogin.m
 //  Crypto Cloud Technology Nextcloud
 //
-//  Created by Marino Faggiana on 11/09/14.
+//  Created by Marino Faggiana on 09/04/15.
 //  Copyright (c) 2014 TWS. All rights reserved.
 //
 //  Author Marino Faggiana <m.faggiana@twsweb.it>
@@ -22,250 +22,258 @@
 //
 
 #import "CCLogin.h"
-
 #import "AppDelegate.h"
+#import "CCUtility.h"
+#import "CCCoreData.h"
 
 @implementation CCLogin
 
--  (id)initWithCoder:(NSCoder *)aDecoder
-{
-    if (self = [super initWithCoder:aDecoder])  {
-        
-        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(loginCorrect) name:@"messageLoginCorrect" object:nil];
-        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(loginIncorrect) name:@"messageLoginIncorrect" object:nil];
-    }
-    return self;
-}
-
 - (void)viewDidLoad
 {
     [super viewDidLoad];
     
-    self.brand.image = [UIImage imageNamed:image_launchscreen];
+    if (([app.typeCloud isEqualToString:typeCloudNextcloud] || [app.typeCloud isEqualToString:typeCloudOwnCloud])&& app.activeAccount) {
+        self.baseUrl.text = app.activeUrl;
+        self.user.text = app.activeUser;
+    }
     
-    [_nextcloud setTitle:[NSString stringWithFormat:@"     %@", NSLocalizedString(@"_add_your_nextcloud_", nil)] forState:UIControlStateNormal];
+    [self.baseUrl setDelegate:self];
+    [self.password setDelegate:self];
+    [self.user setDelegate:self];
+    
+    [self.baseUrl setFont:[UIFont systemFontOfSize:13]];
+    [self.user setFont:[UIFont systemFontOfSize:13]];
+    [self.password setFont:[UIFont systemFontOfSize:13]];
+    
+    self.loadingBaseUrl.image = [UIImage animatedImageWithAnimatedGIFURL:[[NSBundle mainBundle] URLForResource: @"loading" withExtension:@"gif"]];
+    self.loadingBaseUrl.hidden = YES;
+    
+    if (_modifyOnlyPassword) {
+        _baseUrl.userInteractionEnabled = NO;
+        _baseUrl.textColor = [UIColor lightGrayColor];
+        _user.userInteractionEnabled = NO;
+        _user.textColor = [UIColor lightGrayColor];
+    }
 }
 
--(void)viewDidAppear:(BOOL)animated
+- (void)viewWillAppear:(BOOL)animated
 {
-    [super viewDidAppear:animated];
+    [super viewWillAppear:animated];
+
+    [self.annulla setTitle:NSLocalizedString(@"_cancel_", nil) forState:UIControlStateNormal];
+    [self.login setTitle:NSLocalizedString(@"_login_", nil) forState:UIControlStateNormal];
     
-    [self selectFunction];
+    // verify URL
+    if (_modifyOnlyPassword && [self.baseUrl.text length] > 0)
+        [self testUrl];
 }
 
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark == select Function ==
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)selectFunction
+- (BOOL)textFieldShouldReturn:(UITextField *)textField
 {
-    // Show Intro
-    if ([CCUtility getIntro:@"1.0"] == NO) {
-        
-        self.intro = [[CCIntro alloc] initWithDelegate:self delegateView:self.view];
-        [self.intro showIntroCryptoCloud:2.0];
-    }
-    
-    //REMOVECODE
-    /*
-    // Request : Passcode
-    if ([CCUtility getIntro:@"1.0"] == YES && [[CCUtility getKeyChainPasscodeForUUID:[CCUtility getUUID]] length] == 0) {
-        
-        [self passcodeVC];
-    }
-     
-    // Request : Send Passcode email
-    if ([CCUtility getIntro:@"1.0"] == YES && [[CCUtility getKeyChainPasscodeForUUID:[CCUtility getUUID]] length] > 0 && [CCUtility getEmail] == nil && [app.activeAccount length] == 0) {
-        
-        CCSecurityOptions *viewController = [[CCSecurityOptions alloc] initWithDelegate:self];
-        UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
-        [navigationController setModalPresentationStyle:UIModalPresentationFormSheet];
-        
-        [self presentViewController:navigationController animated:YES completion:nil];
-    }
+    [textField resignFirstResponder];
+    return YES;
+}
 
-     
-    // OK all - Close
-    if ([CCUtility getIntro:@"1.0"] == YES && [[CCUtility getKeyChainPasscodeForUUID:[CCUtility getUUID]] length] > 0 && [app.activeAccount length] > 0) {
-        
-        [self loginCorrect];
-    }
-    */
-    
-    if ([CCUtility getIntro:@"1.0"] == YES && [app.activeAccount length] > 0) {
-         [self loginCorrect];
-    }
+- (void)didReceiveMemoryWarning
+{
+    [super didReceiveMemoryWarning];
+    // Dispose of any resources that can be recreated.
 }
 
 #pragma --------------------------------------------------------------------------------------------
-#pragma mark == IBAction ==
+#pragma mark == Chech Server URL ==
 #pragma --------------------------------------------------------------------------------------------
 
-- (IBAction)handleNextcloud:(id)sender
+- (void)testUrl
 {
-    //REMOVECODE
-    // Request CODE
-    /*
-    if ([[CCUtility getKeyChainPasscodeForUUID:[CCUtility getUUID]] length] == 0) {
-        
-        [self passcodeVC];
-        return;
-    }
-    */
+    self.login.enabled = NO;
+    self.loadingBaseUrl.hidden = NO;
     
-    CCLoginNCOC *loginVC = [[UIStoryboard storyboardWithName:@"CCLogin" bundle:nil] instantiateViewControllerWithIdentifier:@"CCLoginNextcloud"];
+    NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:self.baseUrl.text] cachePolicy:0 timeoutInterval:20.0];
+    [request addValue:[CCUtility getUserAgent:_typeCloud] forHTTPHeaderField:@"User-Agent"];
     
-    [loginVC setModifyOnlyPassword:NO];
-    [loginVC setTypeCloud:typeCloudNextcloud];
+    NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
+    NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration delegate:self delegateQueue:nil];
     
-    [self presentViewController:loginVC animated:YES completion:NULL];
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark == BKPasscodeViewController ==
-#pragma --------------------------------------------------------------------------------------------
+    NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler: ^(NSData *data, NSURLResponse *response, NSError *error) {
+        
+        dispatch_async(dispatch_get_main_queue(), ^{
+            self.login.enabled = YES;
+            self.loadingBaseUrl.hidden = YES;
+        });
 
-- (void)passcodeViewController:(BKPasscodeViewController *)aViewController didFinishWithPasscode:(NSString *)aPasscode
-{
-    switch (aViewController.type) {
-        case BKPasscodeViewControllerNewPasscodeType:
-        case BKPasscodeViewControllerCheckPasscodeType: {
+        if (error != nil) {
             
-                // min passcode 4 chars
-                if ([aPasscode length] >= 4) {
+            NSLog(@"[LOG] Error: %ld - %@",(long)[error code] , [error localizedDescription]);
             
-                    [CCUtility setKeyChainPasscodeForUUID:[CCUtility getUUID] conPasscode:aPasscode];
-                    
-                    // verify
-                    NSString *pwd = [CCUtility getKeyChainPasscodeForUUID:[CCUtility getUUID]];
-                    
-                    if ([pwd isEqualToString:aPasscode] == NO || pwd == nil) {
-                        
-                        UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"_error_", nil) message:@"Fatal error writing key" delegate:nil cancelButtonTitle:nil otherButtonTitles:NSLocalizedString(@"_ok_", nil), nil];
-                        [alertView show];
-                    }
-                    
-                } else {
-                    
-                    UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"_error_", nil) message:NSLocalizedString(@"_passcode_too_short_", nil) delegate:nil cancelButtonTitle:nil otherButtonTitles:NSLocalizedString(@"_ok_", nil), nil];
-                    [alertView show];
-                }
+            // self signed certificate
+            if ([error code] == NSURLErrorServerCertificateUntrusted) {
+                
+                NSLog(@"[LOG] Error NSURLErrorServerCertificateUntrusted");
+                
+                dispatch_async(dispatch_get_main_queue(), ^{
+                    [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:[error localizedDescription] viewController:self delegate:self];
+                });
             
-                [aViewController dismissViewControllerAnimated:YES completion:nil];
-            }
-            break;
-        case BKPasscodeViewControllerChangePasscodeType:
-            if ([aPasscode length]) {
+            } else {
                 
-                // [CCUtility WriteDatiLogin:@"" ConNomeUtente:@"" ConPassword:@"" ConPassCode:aPasscode];
-                // [aViewController dismissViewControllerAnimated:YES completion:nil];
+                dispatch_async(dispatch_get_main_queue(), ^{
+                    
+                    alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"_connection_error_",nil) message:[error localizedDescription] delegate:nil cancelButtonTitle:nil otherButtonTitles:NSLocalizedString(@"_ok_", nil), nil];
+                    [alertView show];
+                    
+                    if (!_modifyOnlyPassword)
+                        self.baseUrl.text = @"";
+                });
             }
+            
+        }
+    }];
+    
+    [task resume];
+}
 
-            self.failedAttempts = 0;
-            self.lockUntilDate = nil;
-            break;
-        default:
-            break;
-    }
+- (void)trustedCerticateAccepted
+{
+    NSLog(@"[LOG] Certificate trusted");
 }
 
-- (void)passcodeViewController:(BKPasscodeViewController *)aViewController authenticatePasscode:(NSString *)aPasscode resultHandler:(void (^)(BOOL))aResultHandler
+- (void)trustedCerticateDenied
 {
-    if ([aPasscode length]) {
-        
-        self.lockUntilDate = nil;
-        self.failedAttempts = 0;
-        aResultHandler(YES);
-        
-     } else {
-         
-        aResultHandler(NO);
-     }
+    if (_modifyOnlyPassword)
+        [self handleAnnulla:self];
 }
 
-- (void)passcodeViewControllerDidFailAttempt:(BKPasscodeViewController *)aViewController
+-(void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential * _Nullable))completionHandler
+{
+    // The pinnning check
+    
+    if ([[CCCertificate sharedManager] checkTrustedChallenge:challenge]) {
+        completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]);
+    } else {
+        completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil);
+    }
+}
+
+#pragma --------------------------------------------------------------------------------------------
+#pragma mark == Login ==
+#pragma --------------------------------------------------------------------------------------------
+
+- (void)loginCloud
 {
-    self.failedAttempts++;
+    self.login.enabled = NO;
+    self.loadingBaseUrl.hidden = NO;
+
+    // remove last char if /
+    if ([[self.baseUrl.text substringFromIndex:[self.baseUrl.text length] - 1] isEqualToString:@"/"])
+        self.baseUrl.text = [self.baseUrl.text substringToIndex:[self.baseUrl.text length] - 1];
+    
+    OCnetworking *ocNet = [[OCnetworking alloc] initWithDelegate:self metadataNet:nil withUser:self.user.text withPassword:self.password.text withUrl:nil withTypeCloud:_typeCloud activityIndicator:NO isCryptoCloudMode:NO];
+    NSError *error = [ocNet readFileSync:[NSString stringWithFormat:@"%@%@", self.baseUrl.text, webDAV]];
     
-    if (self.failedAttempts > 5) {
+    if (!error) {
         
-        NSTimeInterval timeInterval = 60;
+        // account
+        NSString *account = [NSString stringWithFormat:@"%@ %@", self.user.text, self.baseUrl.text];
         
-        if (self.failedAttempts > 6) {
+        if (_modifyOnlyPassword) {
             
-            NSUInteger multiplier = self.failedAttempts - 6;
+            [CCCoreData updateAccount:account withPassword:self.password.text];
             
-            timeInterval = (5 * 60) * multiplier;
+        } else {
+
+            [CCCoreData deleteAccount:account];
+        
+            // Add default account
+            [CCCoreData addAccount:account url:self.baseUrl.text user:self.user.text password:self.password.text uid:nil typeCloud:_typeCloud];
+        }
+        
+        TableAccount *tableAccount = [CCCoreData setActiveAccount:account];
+        
+        // verifica
+        if ([tableAccount.account isEqualToString:account]) {
             
-            if (timeInterval > 3600 * 24) {
-                timeInterval = 3600 * 24;
-            }
+            [app settingActiveAccount:tableAccount.account activeUrl:tableAccount.url activeUser:tableAccount.user activePassword:tableAccount.password activeUID:nil activeAccessToken:nil typeCloud:tableAccount.typeCloud];
+            
+            [self dismissViewControllerAnimated:YES completion:nil];
+            
+        } else {
+            
+            if (_modifyOnlyPassword == NO)
+                [CCCoreData deleteAccount:account];
+            
+            alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"_error_", nil) message:@"Fatal error writing database" delegate:nil cancelButtonTitle:nil otherButtonTitles:NSLocalizedString(@"_ok_", nil), nil];
+            [alertView show];
         }
+
+    } else {
         
-        self.lockUntilDate = [NSDate dateWithTimeIntervalSinceNow:timeInterval];
+        if ([error code] != NSURLErrorServerCertificateUntrusted) {
+            
+            NSString *description = [error.userInfo objectForKey:@"NSLocalizedDescription"];
+            NSString *message = [NSString stringWithFormat:@"%@.\n%@", NSLocalizedStringFromTable(@"_not_possible_connect_to_server_", @"Error", nil), description];
+            
+            alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"_error_", nil) message:message delegate:nil cancelButtonTitle:nil otherButtonTitles:NSLocalizedString(@"_ok_", nil), nil];
+            [alertView show];
+        }
     }
+        
+    self.login.enabled = YES;
+    self.loadingBaseUrl.hidden = YES;
 }
 
-- (NSUInteger)passcodeViewControllerNumberOfFailedAttempts:(BKPasscodeViewController *)aViewController
-{
-    return self.failedAttempts;
-}
+#pragma --------------------------------------------------------------------------------------------
+#pragma mark == TextField ==
+#pragma --------------------------------------------------------------------------------------------
 
-- (NSDate *)passcodeViewControllerLockUntilDate:(BKPasscodeViewController *)aViewController
+-(void)textFieldDidBeginEditing:(UITextField *)textField
 {
-    return self.lockUntilDate;
+    if (textField == self.password) {
+        self.toggleVisiblePassword.hidden = NO;
+        self.password.defaultTextAttributes = @{NSFontAttributeName: [UIFont systemFontOfSize:14.0f], NSForegroundColorAttributeName: [UIColor darkGrayColor]};
+    }
 }
 
-- (void)passcodeViewCloseButtonPressed:(id)sender
+-(void)textFieldDidEndEditing:(UITextField *)textField
 {
-    [self dismissViewControllerAnimated:YES completion:nil];
+    if (textField == self.password) {
+        self.toggleVisiblePassword.hidden = YES;
+        self.password.defaultTextAttributes = @{NSFontAttributeName: [UIFont systemFontOfSize:14.0f], NSForegroundColorAttributeName: [UIColor darkGrayColor]};
+    }
 }
 
 #pragma --------------------------------------------------------------------------------------------
-#pragma mark == Intro Delegate ==
+#pragma mark == IBAction ==
 #pragma --------------------------------------------------------------------------------------------
 
-- (void)introDidFinish:(EAIntroView *)introView wasSkipped:(BOOL)wasSkipped
+- (IBAction)handlebaseUrlchange:(id)sender
 {
-    [CCUtility setIntro:@"1.0"];
-    
-    [self selectFunction];
+    if ([self.baseUrl.text length] > 0)
+        [self performSelector:@selector(testUrl) withObject:nil];
 }
 
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark == navigation ==
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)passcodeVC
+- (IBAction)handleButtonLogin:(id)sender
 {
-    CCBKPasscode *viewController = [[CCBKPasscode alloc] initWithNibName:nil bundle:nil];
-    viewController.delegate = self;
-    viewController.type = BKPasscodeViewControllerNewPasscodeType;
-    
-    viewController.passcodeStyle = BKPasscodeInputViewNormalPasscodeStyle;
-    viewController.passcodeInputView.maximumLength = 64;
-    
-    viewController.title = NSLocalizedString(@"_key_aes_256_", nil);
-    
-    UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
-    
-    [self presentViewController:navigationController animated:YES completion:nil];
+    if ([self.baseUrl.text length] > 0 && [self.user.text length] && [self.password.text length])
+        [self performSelector:@selector(loginCloud) withObject:nil];
 }
 
-- (void)loginCorrect
-{    
-    [[NSNotificationCenter defaultCenter] postNotificationName:@"initializeMain" object:nil];
+- (IBAction)handleAnnulla:(id)sender
+{
+    [[NSNotificationCenter defaultCenter] postNotificationName:@"messageLoginIncorrect" object:nil];
     
-    // close
-    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
-        
-        [self dismissViewControllerAnimated:YES completion:nil];
-    });
+    [self dismissViewControllerAnimated:YES completion:nil];
 }
 
-- (void)loginIncorrect
+- (IBAction)handleToggleVisiblePassword:(id)sender
 {
-    NSLog(@"[LOG] Incorrect login");
+    NSString *currentPassword = self.password.text;
+    
+    self.password.secureTextEntry = ! self.password.secureTextEntry;
+    
+    self.password.text = @"";
+    self.password.text = currentPassword;
+    self.password.defaultTextAttributes = @{NSFontAttributeName: [UIFont systemFontOfSize:14.0f], NSForegroundColorAttributeName: [UIColor darkGrayColor]};
 }
 
 @end

+ 2 - 51
iOSClient/Login/CCLogin.storyboard

@@ -11,56 +11,9 @@
     </dependencies>
     <scenes>
         <!--Login-->
-        <scene sceneID="IVZ-Md-KoU">
-            <objects>
-                <viewController storyboardIdentifier="CCLogin" id="oPR-g1-XDa" customClass="CCLogin" sceneMemberID="viewController">
-                    <layoutGuides>
-                        <viewControllerLayoutGuide type="top" id="xoq-cv-qyX"/>
-                        <viewControllerLayoutGuide type="bottom" id="UlD-ew-Lo3"/>
-                    </layoutGuides>
-                    <view key="view" contentMode="scaleToFill" id="Z1v-4b-0Rh">
-                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
-                        <subviews>
-                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="B7w-T7-jkG">
-                                <rect key="frame" x="16" y="359" width="300" height="60"/>
-                                <constraints>
-                                    <constraint firstAttribute="width" constant="300" id="64Q-qN-Vng"/>
-                                    <constraint firstAttribute="height" constant="60" id="PFP-Wy-f1y"/>
-                                </constraints>
-                                <fontDescription key="fontDescription" type="system" pointSize="13"/>
-                                <state key="normal" title="          Nextcloud" image="newAccountNextcloud">
-                                    <color key="titleColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-                                </state>
-                                <connections>
-                                    <action selector="handleNextcloud:" destination="oPR-g1-XDa" eventType="touchUpInside" id="TBv-by-nV6"/>
-                                </connections>
-                            </button>
-                            <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="cryptocloudlaunchscreen" translatesAutoresizingMaskIntoConstraints="NO" id="Wiv-CB-4tC">
-                                <rect key="frame" x="125" y="60" width="125" height="170"/>
-                            </imageView>
-                        </subviews>
-                        <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-                        <constraints>
-                            <constraint firstItem="Wiv-CB-4tC" firstAttribute="centerX" secondItem="Z1v-4b-0Rh" secondAttribute="centerX" id="KP3-6t-E1f"/>
-                            <constraint firstItem="B7w-T7-jkG" firstAttribute="leading" secondItem="Z1v-4b-0Rh" secondAttribute="leadingMargin" id="eRx-mo-gkj"/>
-                            <constraint firstItem="Wiv-CB-4tC" firstAttribute="top" secondItem="xoq-cv-qyX" secondAttribute="bottom" constant="40" id="fj7-a1-J1t"/>
-                            <constraint firstItem="B7w-T7-jkG" firstAttribute="top" secondItem="Wiv-CB-4tC" secondAttribute="bottom" constant="129" id="jBU-bo-KkM"/>
-                        </constraints>
-                    </view>
-                    <connections>
-                        <outlet property="brand" destination="Wiv-CB-4tC" id="Z0L-4I-2dj"/>
-                        <outlet property="nextcloud" destination="B7w-T7-jkG" id="q36-wu-sBn"/>
-                    </connections>
-                </viewController>
-                <placeholder placeholderIdentifier="IBFirstResponder" id="sK9-Ew-RED" userLabel="First Responder" sceneMemberID="firstResponder"/>
-            </objects>
-            <point key="canvasLocation" x="3071" y="-981"/>
-        </scene>
-        <!--LoginNCOC-->
         <scene sceneID="fVe-zF-WhZ">
             <objects>
-                <viewController storyboardIdentifier="CCLoginNextcloud" id="yj9-jo-WIn" customClass="CCLoginNCOC" sceneMemberID="viewController">
+                <viewController storyboardIdentifier="CCLoginNextcloud" id="yj9-jo-WIn" customClass="CCLogin" sceneMemberID="viewController">
                     <layoutGuides>
                         <viewControllerLayoutGuide type="top" id="3IQ-ds-9vR"/>
                         <viewControllerLayoutGuide type="bottom" id="olW-Hc-7Im"/>
@@ -218,14 +171,12 @@
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="dCU-1X-uQw" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
-            <point key="canvasLocation" x="3772" y="-982"/>
+            <point key="canvasLocation" x="3591" y="-1211"/>
         </scene>
     </scenes>
     <resources>
         <image name="ImageLoginNextcloud" width="300" height="200"/>
         <image name="baseurlNextcloud" width="25" height="25"/>
-        <image name="cryptocloudlaunchscreen" width="125" height="170"/>
-        <image name="newAccountNextcloud" width="50" height="50"/>
         <image name="passwordNextcloud" width="25" height="25"/>
         <image name="userNextcloud" width="25" height="25"/>
         <image name="visiblePassword" width="25" height="25"/>

+ 0 - 50
iOSClient/Login/CCLoginNCOC.h

@@ -1,50 +0,0 @@
-//
-//  CCLoginNCOC.h
-//  Crypto Cloud Technology Nextcloud
-//
-//  Created by Marino Faggiana on 09/04/15.
-//  Copyright (c) 2014 TWS. All rights reserved.
-//
-//  Author Marino Faggiana <m.faggiana@twsweb.it>
-//
-//  This program is free software: you can redistribute it and/or modify
-//  it under the terms of the GNU General Public License as published by
-//  the Free Software Foundation, either version 3 of the License, or
-//  (at your option) any later version.
-//
-//  This program is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//  GNU General Public License for more details.
-//
-//  You should have received a copy of the GNU General Public License
-//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-
-#import <UIKit/UIKit.h>
-
-#import "UIImage+animatedGIF.h"
-#import "CCCertificate.h"
-#import "OCNetworking.h"
-
-@interface CCLoginNCOC : UIViewController <UITextFieldDelegate, NSURLSessionTaskDelegate, NSURLSessionDelegate, CCCertificateDelegate, OCNetworkingDelegate>
-
-{
-    UIAlertView *alertView;
-    UIView *rootView;
-}
-
-@property (nonatomic, weak) IBOutlet UITextField *user;
-@property (nonatomic, weak) IBOutlet UITextField *password;
-@property (nonatomic, weak) IBOutlet UITextField *baseUrl;
-@property (nonatomic, weak) IBOutlet UIImageView *loadingBaseUrl;
-
-@property (nonatomic, weak) IBOutlet UIButton *login;
-@property (nonatomic, weak) IBOutlet UIButton *annulla;
-@property (nonatomic, weak) IBOutlet UIButton *toggleVisiblePassword;
-
-@property BOOL modifyOnlyPassword;
-@property (nonatomic, strong) NSString *typeCloud;
-@property (nonatomic, strong) UIViewController *viewController;
-
-@end

+ 0 - 281
iOSClient/Login/CCLoginNCOC.m

@@ -1,281 +0,0 @@
-//
-//  CCLoginNCOC.m
-//  Crypto Cloud Technology Nextcloud
-//
-//  Created by Marino Faggiana on 09/04/15.
-//  Copyright (c) 2014 TWS. All rights reserved.
-//
-//  Author Marino Faggiana <m.faggiana@twsweb.it>
-//
-//  This program is free software: you can redistribute it and/or modify
-//  it under the terms of the GNU General Public License as published by
-//  the Free Software Foundation, either version 3 of the License, or
-//  (at your option) any later version.
-//
-//  This program is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//  GNU General Public License for more details.
-//
-//  You should have received a copy of the GNU General Public License
-//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-
-#import "CCLoginNCOC.h"
-
-#import "AppDelegate.h"
-#import "CCUtility.h"
-#import "CCCoreData.h"
-
-@implementation CCLoginNCOC
-
-- (void)viewDidLoad
-{
-    [super viewDidLoad];
-    
-    if (([app.typeCloud isEqualToString:typeCloudNextcloud] || [app.typeCloud isEqualToString:typeCloudOwnCloud])&& app.activeAccount) {
-        self.baseUrl.text = app.activeUrl;
-        self.user.text = app.activeUser;
-    }
-    
-    [self.baseUrl setDelegate:self];
-    [self.password setDelegate:self];
-    [self.user setDelegate:self];
-    
-    [self.baseUrl setFont:[UIFont systemFontOfSize:13]];
-    [self.user setFont:[UIFont systemFontOfSize:13]];
-    [self.password setFont:[UIFont systemFontOfSize:13]];
-    
-    self.loadingBaseUrl.image = [UIImage animatedImageWithAnimatedGIFURL:[[NSBundle mainBundle] URLForResource: @"loading" withExtension:@"gif"]];
-    self.loadingBaseUrl.hidden = YES;
-    
-    if (_modifyOnlyPassword) {
-        _baseUrl.userInteractionEnabled = NO;
-        _baseUrl.textColor = [UIColor lightGrayColor];
-        _user.userInteractionEnabled = NO;
-        _user.textColor = [UIColor lightGrayColor];
-    }
-}
-
-- (void)viewWillAppear:(BOOL)animated
-{
-    [super viewWillAppear:animated];
-
-    [self.annulla setTitle:NSLocalizedString(@"_cancel_", nil) forState:UIControlStateNormal];
-    [self.login setTitle:NSLocalizedString(@"_login_", nil) forState:UIControlStateNormal];
-    
-    // verify URL
-    if (_modifyOnlyPassword && [self.baseUrl.text length] > 0)
-        [self testUrl];
-}
-
-
-- (BOOL)textFieldShouldReturn:(UITextField *)textField
-{
-    [textField resignFirstResponder];
-    return YES;
-}
-
-- (void)didReceiveMemoryWarning
-{
-    [super didReceiveMemoryWarning];
-    // Dispose of any resources that can be recreated.
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark == Chech Server URL ==
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)testUrl
-{
-    self.login.enabled = NO;
-    self.loadingBaseUrl.hidden = NO;
-    
-    NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:self.baseUrl.text] cachePolicy:0 timeoutInterval:20.0];
-    [request addValue:[CCUtility getUserAgent:_typeCloud] forHTTPHeaderField:@"User-Agent"];
-    
-    NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
-    NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration delegate:self delegateQueue:nil];
-    
-    NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler: ^(NSData *data, NSURLResponse *response, NSError *error) {
-        
-        dispatch_async(dispatch_get_main_queue(), ^{
-            self.login.enabled = YES;
-            self.loadingBaseUrl.hidden = YES;
-        });
-
-        if (error != nil) {
-            
-            NSLog(@"[LOG] Error: %ld - %@",(long)[error code] , [error localizedDescription]);
-            
-            // self signed certificate
-            if ([error code] == NSURLErrorServerCertificateUntrusted) {
-                
-                NSLog(@"[LOG] Error NSURLErrorServerCertificateUntrusted");
-                
-                dispatch_async(dispatch_get_main_queue(), ^{
-                    [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:[error localizedDescription] viewController:self delegate:self];
-                });
-            
-            } else {
-                
-                dispatch_async(dispatch_get_main_queue(), ^{
-                    
-                    alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"_connection_error_",nil) message:[error localizedDescription] delegate:nil cancelButtonTitle:nil otherButtonTitles:NSLocalizedString(@"_ok_", nil), nil];
-                    [alertView show];
-                    
-                    if (!_modifyOnlyPassword)
-                        self.baseUrl.text = @"";
-                });
-            }
-            
-        }
-    }];
-    
-    [task resume];
-}
-
-- (void)trustedCerticateAccepted
-{
-    NSLog(@"[LOG] Certificate trusted");
-}
-
-- (void)trustedCerticateDenied
-{
-    if (_modifyOnlyPassword)
-        [self handleAnnulla:self];
-}
-
--(void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential * _Nullable))completionHandler
-{
-    // The pinnning check
-    
-    if ([[CCCertificate sharedManager] checkTrustedChallenge:challenge]) {
-        completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]);
-    } else {
-        completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil);
-    }
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark == Login ==
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)loginNCOC
-{
-    self.login.enabled = NO;
-    self.loadingBaseUrl.hidden = NO;
-
-    // remove last char if /
-    if ([[self.baseUrl.text substringFromIndex:[self.baseUrl.text length] - 1] isEqualToString:@"/"])
-        self.baseUrl.text = [self.baseUrl.text substringToIndex:[self.baseUrl.text length] - 1];
-    
-    OCnetworking *ocNet = [[OCnetworking alloc] initWithDelegate:self metadataNet:nil withUser:self.user.text withPassword:self.password.text withUrl:nil withTypeCloud:_typeCloud activityIndicator:NO isCryptoCloudMode:NO];
-    NSError *error = [ocNet readFileSync:[NSString stringWithFormat:@"%@%@", self.baseUrl.text, webDAV]];
-    
-    if (!error) {
-        
-        // account
-        NSString *account = [NSString stringWithFormat:@"%@ %@", self.user.text, self.baseUrl.text];
-        
-        if (_modifyOnlyPassword) {
-            
-            [CCCoreData updateAccount:account withPassword:self.password.text];
-            
-        } else {
-
-            [CCCoreData deleteAccount:account];
-        
-            // Add default account
-            [CCCoreData addAccount:account url:self.baseUrl.text user:self.user.text password:self.password.text uid:nil typeCloud:_typeCloud];
-        }
-        
-        TableAccount *tableAccount = [CCCoreData setActiveAccount:account];
-        
-        // verifica
-        if ([tableAccount.account isEqualToString:account]) {
-            
-            [app settingActiveAccount:tableAccount.account activeUrl:tableAccount.url activeUser:tableAccount.user activePassword:tableAccount.password activeUID:nil activeAccessToken:nil typeCloud:tableAccount.typeCloud];
-            
-            [self dismissViewControllerAnimated:YES completion:nil];
-            
-        } else {
-            
-            if (_modifyOnlyPassword == NO)
-                [CCCoreData deleteAccount:account];
-            
-            alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"_error_", nil) message:@"Fatal error writing database" delegate:nil cancelButtonTitle:nil otherButtonTitles:NSLocalizedString(@"_ok_", nil), nil];
-            [alertView show];
-        }
-
-    } else {
-        
-        if ([error code] != NSURLErrorServerCertificateUntrusted) {
-            
-            NSString *description = [error.userInfo objectForKey:@"NSLocalizedDescription"];
-            NSString *message = [NSString stringWithFormat:@"%@.\n%@", NSLocalizedStringFromTable(@"_not_possible_connect_to_server_", @"Error", nil), description];
-            
-            alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"_error_", nil) message:message delegate:nil cancelButtonTitle:nil otherButtonTitles:NSLocalizedString(@"_ok_", nil), nil];
-            [alertView show];
-        }
-    }
-        
-    self.login.enabled = YES;
-    self.loadingBaseUrl.hidden = YES;
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark == TextField ==
-#pragma --------------------------------------------------------------------------------------------
-
--(void)textFieldDidBeginEditing:(UITextField *)textField
-{
-    if (textField == self.password) {
-        self.toggleVisiblePassword.hidden = NO;
-        self.password.defaultTextAttributes = @{NSFontAttributeName: [UIFont systemFontOfSize:14.0f], NSForegroundColorAttributeName: [UIColor darkGrayColor]};
-    }
-}
-
--(void)textFieldDidEndEditing:(UITextField *)textField
-{
-    if (textField == self.password) {
-        self.toggleVisiblePassword.hidden = YES;
-        self.password.defaultTextAttributes = @{NSFontAttributeName: [UIFont systemFontOfSize:14.0f], NSForegroundColorAttributeName: [UIColor darkGrayColor]};
-    }
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark == IBAction ==
-#pragma --------------------------------------------------------------------------------------------
-
-- (IBAction)handlebaseUrlchange:(id)sender
-{
-    if ([self.baseUrl.text length] > 0)
-        [self performSelector:@selector(testUrl) withObject:nil];
-}
-
-- (IBAction)handleButtonLogin:(id)sender
-{
-    if ([self.baseUrl.text length] > 0 && [self.user.text length] && [self.password.text length])
-        [self performSelector:@selector(loginNCOC) withObject:nil];
-}
-
-- (IBAction)handleAnnulla:(id)sender
-{
-    [[NSNotificationCenter defaultCenter] postNotificationName:@"messageLoginIncorrect" object:nil];
-    
-    [self dismissViewControllerAnimated:YES completion:nil];
-}
-
-- (IBAction)handleToggleVisiblePassword:(id)sender
-{
-    NSString *currentPassword = self.password.text;
-    
-    self.password.secureTextEntry = ! self.password.secureTextEntry;
-    
-    self.password.text = @"";
-    self.password.text = currentPassword;
-    self.password.defaultTextAttributes = @{NSFontAttributeName: [UIFont systemFontOfSize:14.0f], NSForegroundColorAttributeName: [UIColor darkGrayColor]};
-}
-
-@end

+ 1 - 1
iOSClient/Main/CCMain.h

@@ -33,7 +33,7 @@
 #import "BKPasscodeViewController.h"
 #import "NSString+TruncateToWidth.h"
 #import "UINavigationController+CCProgress.h"
-#import "CCLoginNCOC.h"
+#import "CCLogin.h"
 #import "CCCellMain.h"
 #import "CCCellMainTransfer.h"
 #import "CCMove.h"

+ 1 - 4
iOSClient/Main/CCMain.m

@@ -1005,14 +1005,11 @@
 
 - (void)changePasswordAccount
 {
-    CCLoginNCOC *loginVC;
+    CCLogin *loginVC;
 
     if ([app.typeCloud isEqualToString:typeCloudNextcloud])
         loginVC = [[UIStoryboard storyboardWithName:@"CCLogin" bundle:nil] instantiateViewControllerWithIdentifier:@"CCLoginNextcloud"];
     
-    if ([app.typeCloud isEqualToString:typeCloudOwnCloud])
-        loginVC = [[UIStoryboard storyboardWithName:@"CCLogin" bundle:nil] instantiateViewControllerWithIdentifier:@"CCLoginOwnCloud"];
-    
     [loginVC setModifyOnlyPassword:YES];
     [loginVC setTypeCloud:app.typeCloud];
     

+ 1 - 3
iOSClient/Main/CCSplit.m

@@ -136,11 +136,9 @@
 
 - (void)newAccount
 {
-    // REMOVECODE
-    //if ([app.activeAccount length] == 0 || [[CCUtility getKeyChainPasscodeForUUID:[CCUtility getUUID]] length] == 0) {
     if ([app.activeAccount length] == 0) {
     
-        CCLogin *viewController = [[UIStoryboard storyboardWithName:@"CCLogin" bundle:nil] instantiateViewControllerWithIdentifier:@"CCLogin"];
+        CCLogin *viewController = [[UIStoryboard storyboardWithName:@"CCLogin" bundle:nil] instantiateViewControllerWithIdentifier:@"CCLoginNextcloud"];
     
         [self presentViewController:viewController animated:YES completion:nil];
     }

+ 4 - 25
iOSClient/Settings/CCManageAccount.m

@@ -23,7 +23,7 @@
 
 #import "CCManageAccount.h"
 #import "AppDelegate.h"
-#import "CCLoginNCOC.h"
+#import "CCLogin.h"
 
 #define actionSheetCancellaAccount 1
 
@@ -135,7 +135,7 @@
     [app cancelAllOperations];
     [[CCNetworking sharedNetworking] settingSessionsDownload:YES upload:YES taskStatus:k_taskStatusCancel activeAccount:app.activeAccount activeUser:app.activeUser activeUrl:app.activeUrl];
     
-    CCLoginNCOC *loginVC = [[UIStoryboard storyboardWithName:@"CCLogin" bundle:nil] instantiateViewControllerWithIdentifier:@"CCLoginNextcloud"];
+    CCLogin *loginVC = [[UIStoryboard storyboardWithName:@"CCLogin" bundle:nil] instantiateViewControllerWithIdentifier:@"CCLoginNextcloud"];
     
     [loginVC setModifyOnlyPassword:NO];
     [loginVC setTypeCloud:typeCloudNextcloud];
@@ -143,27 +143,12 @@
     [self presentViewController:loginVC animated:YES completion:nil];
 }
 
-- (void)addAccountOwnCloud:(XLFormRowDescriptor *)sender
-{
-    [self deselectFormRow:sender];
-    
-    [app cancelAllOperations];
-    [[CCNetworking sharedNetworking] settingSessionsDownload:YES upload:YES taskStatus:k_taskStatusCancel activeAccount:app.activeAccount activeUser:app.activeUser activeUrl:app.activeUrl];
-
-    CCLoginNCOC *loginVC = [[UIStoryboard storyboardWithName:@"CCLogin" bundle:nil] instantiateViewControllerWithIdentifier:@"CCLoginOwnCloud"];
-    
-    [loginVC setModifyOnlyPassword:NO];
-    [loginVC setTypeCloud:typeCloudOwnCloud];
-    
-    [self presentViewController:loginVC animated:YES completion:nil];
-}
-
 - (void)openLoginSetupVC
 {    
     // remove any message
     [[NSNotificationCenter defaultCenter] removeObserver:self];
     
-    CCLogin *viewController = [[UIStoryboard storyboardWithName:@"CCLogin" bundle:nil] instantiateViewControllerWithIdentifier:@"CCLogin"];
+    CCLogin *viewController = [[UIStoryboard storyboardWithName:@"CCLogin" bundle:nil] instantiateViewControllerWithIdentifier:@"CCLoginNextcloud"];
     
     dispatch_async(dispatch_get_main_queue(), ^ {
         [self presentViewController:viewController animated:YES completion:nil];
@@ -184,14 +169,8 @@
     [[CCNetworking sharedNetworking] settingSessionsDownload:YES upload:YES taskStatus:k_taskStatusCancel activeAccount:app.activeAccount activeUser:app.activeUser activeUrl:app.activeUrl];
     
     if ([app.typeCloud isEqualToString:typeCloudNextcloud] || [app.typeCloud isEqualToString:typeCloudOwnCloud]) {
-    
-        if ([app.typeCloud isEqualToString:typeCloudNextcloud])
-            vcName = @"CCLoginNextcloud";
         
-        if ([app.typeCloud isEqualToString:typeCloudOwnCloud])
-            vcName = @"CCLoginOwnCloud";
-    
-        CCLoginNCOC *loginVC = [[UIStoryboard storyboardWithName:@"CCLogin" bundle:nil] instantiateViewControllerWithIdentifier:vcName];
+        CCLogin *loginVC = [[UIStoryboard storyboardWithName:@"CCLogin" bundle:nil] instantiateViewControllerWithIdentifier: @"CCLoginNextcloud"];
         
         [loginVC setModifyOnlyPassword:YES];
         [loginVC setTypeCloud:app.typeCloud];