ソースを参照

remove old code

marinofaggiana 4 年 前
コミット
fa0f068b50
3 ファイル変更0 行追加531 行削除
  1. 0 6
      Nextcloud.xcodeproj/project.pbxproj
  2. 0 49
      iOSClient/Login/CCLogin.h
  3. 0 476
      iOSClient/Login/CCLogin.m

+ 0 - 6
Nextcloud.xcodeproj/project.pbxproj

@@ -275,7 +275,6 @@
 		F7BAADC91ED5A87C00B7EAD4 /* NCDatabase.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7BAADB41ED5A87C00B7EAD4 /* NCDatabase.swift */; };
 		F7BAADCB1ED5A87C00B7EAD4 /* NCManageDatabase.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7BAADB51ED5A87C00B7EAD4 /* NCManageDatabase.swift */; };
 		F7BAADCC1ED5A87C00B7EAD4 /* NCManageDatabase.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7BAADB51ED5A87C00B7EAD4 /* NCManageDatabase.swift */; };
-		F7BF1B431D51E893000854F6 /* CCLogin.m in Sources */ = {isa = PBXBuildFile; fileRef = F7BF1B401D51E893000854F6 /* CCLogin.m */; };
 		F7C1EEA525053A9C00866ACC /* NCDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7C1EEA425053A9C00866ACC /* NCDataSource.swift */; };
 		F7C40BEF219994ED0004137E /* KTVCocoaHTTPServer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F7C40BEE219994ED0004137E /* KTVCocoaHTTPServer.framework */; };
 		F7C40BF1219994F20004137E /* KTVHTTPCache.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F7C40BF0219994F20004137E /* KTVHTTPCache.framework */; };
@@ -640,8 +639,6 @@
 		F7BAADB41ED5A87C00B7EAD4 /* NCDatabase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCDatabase.swift; sourceTree = "<group>"; };
 		F7BAADB51ED5A87C00B7EAD4 /* NCManageDatabase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCManageDatabase.swift; sourceTree = "<group>"; };
 		F7BB04851FD58ACB00BBFD2A /* cs-CZ */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "cs-CZ"; path = "cs-CZ.lproj/Localizable.strings"; 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>"; };
 		F7C0F46E1C8880540059EC54 /* ShareViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = ShareViewController.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
 		F7C0F46F1C8880540059EC54 /* ShareViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = ShareViewController.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
 		F7C1EEA425053A9C00866ACC /* NCDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCDataSource.swift; sourceTree = "<group>"; };
@@ -1240,8 +1237,6 @@
 			isa = PBXGroup;
 			children = (
 				F75ADF441DC75FFE008A7347 /* NCLogin.storyboard */,
-				F7BF1B3F1D51E893000854F6 /* CCLogin.h */,
-				F7BF1B401D51E893000854F6 /* CCLogin.m */,
 				F7DBC37B23325E01001A85BA /* NCAppConfigView.swift */,
 				F7C91C9825E6946D005D2490 /* NCLogin.swift */,
 				F7AE00F4230D5F9E007ACF8A /* NCLoginWeb.swift */,
@@ -2083,7 +2078,6 @@
 				F78071091EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.m in Sources */,
 				F765F73125237E3F00391DBE /* NCRecent.swift in Sources */,
 				F76B3CCE1EAE01BD00921AC9 /* NCBrand.swift in Sources */,
-				F7BF1B431D51E893000854F6 /* CCLogin.m in Sources */,
 				F769454422E9F142000A798A /* NCShareUserMenuView.swift in Sources */,
 				F77B0E981D118A16002130FE /* CCManageAccount.m in Sources */,
 				F7EFA47825ADBA500083159A /* NCViewerProviderContextMenu.swift in Sources */,

+ 0 - 49
iOSClient/Login/CCLogin.h

@@ -1,49 +0,0 @@
-//
-//  CCLogin.h
-//  Nextcloud
-//
-//  Created by Marino Faggiana on 09/04/15.
-//  Copyright (c) 2015 Marino Faggiana. All rights reserved.
-//
-//  Author Marino Faggiana <marino.faggiana@nextcloud.com>
-//
-//  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>
-
-@class NCLoginWeb;
-@class NCLoginQRCode;
-
-@interface CCLogin : UIViewController <UITextFieldDelegate>
-
-@property (nonatomic, weak) IBOutlet UIImageView *imageBrand;
-
-@property (nonatomic, weak) IBOutlet UITextField *user;
-@property (nonatomic, weak) IBOutlet UITextField *password;
-@property (nonatomic, weak) IBOutlet UITextField *baseUrl;
-
-@property (nonatomic, weak) IBOutlet UIImageView *imageBaseUrl;
-@property (nonatomic, weak) IBOutlet UIImageView *imageUser;
-@property (nonatomic, weak) IBOutlet UIImageView *imagePassword;
-
-@property (nonatomic, weak) IBOutlet UIActivityIndicatorView *activity;
-
-@property (nonatomic, weak) IBOutlet UIButton *login;
-@property (nonatomic, weak) IBOutlet UIButton *toggleVisiblePassword;
-@property (nonatomic, weak) IBOutlet UIButton *loginTypeView;
-
-@property (nonatomic, weak) IBOutlet UIButton *qrCode;
-
-@end

+ 0 - 476
iOSClient/Login/CCLogin.m

@@ -1,476 +0,0 @@
-//
-//  CCLogin.m
-//  Nextcloud
-//
-//  Created by Marino Faggiana on 09/04/15.
-//  Copyright (c) 2015 Marino Faggiana. All rights reserved.
-//
-//  Author Marino Faggiana <marino.faggiana@nextcloud.com>
-//
-//  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 "CCLogin.h"
-#import "CCUtility.h"
-#import "NSNotificationCenter+MainThread.h"
-#import "NCBridgeSwift.h"
-
-@interface CCLogin () <NCLoginQRCodeDelegate>
-{
-    AppDelegate *appDelegate;
-    UIView *rootView;
-    UIColor *textColor;
-    UIColor *textColorOpponent;
-    UIBarButtonItem *cancelButton;
-}
-@end
-
-@implementation CCLogin
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ===== Init =====
-#pragma --------------------------------------------------------------------------------------------
-
--  (id)initWithCoder:(NSCoder *)aDecoder
-{
-    if (self = [super initWithCoder:aDecoder])  {
-        appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
-    }
-    
-    return self;
-}
-
-- (void)viewDidLoad
-{
-    [super viewDidLoad];
-    
-    Ivar ivar =  class_getInstanceVariable([UITextField class], "_placeholderLabel");
-
-    // Background color
-    self.view.backgroundColor = NCBrandColor.shared.customer;
-    
-    // Text Color
-    BOOL isTooLight = NCBrandColor.shared.customer.isTooLight;
-    BOOL isTooDark = NCBrandColor.shared.customer.isTooDark;
-    if (isTooLight) {
-        textColor = [UIColor blackColor];
-        textColorOpponent = [UIColor whiteColor];
-    } else if (isTooDark) {
-        textColor = [UIColor whiteColor];
-        textColorOpponent = [UIColor blackColor];
-    } else {
-        textColor = [UIColor whiteColor];
-        textColorOpponent = [UIColor blackColor];
-    }
-    
-    // Image Brand
-    self.imageBrand.image = [UIImage imageNamed:@"logo"];
-    
-    // Annulla
-    cancelButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemStop target:self action:@selector(handleAnnulla:)];
-    cancelButton.tintColor = textColor;
-    
-    // Base URL
-    _imageBaseUrl.image = [[UIImage imageNamed:@"loginURL"] imageWithColor:textColor size:50];
-    _baseUrl.textColor = textColor;
-    _baseUrl.tintColor = textColor;
-    _baseUrl.placeholder = NSLocalizedString(@"_login_url_", nil);
-    UILabel *baseUrlPlaceholder = object_getIvar(_baseUrl, ivar);
-    baseUrlPlaceholder.textColor = [textColor colorWithAlphaComponent:0.5];
-    [self.baseUrl setFont:[UIFont systemFontOfSize:13]];
-    [self.baseUrl setDelegate:self];
-    
-    // User
-    _imageUser.image = [[UIImage imageNamed:@"loginUser"] imageWithColor:textColor size:50];
-    _user.textColor = textColor;
-    _user.tintColor = textColor;
-    _user.placeholder = NSLocalizedString(@"_username_", nil);
-    UILabel *userPlaceholder = object_getIvar(_user, ivar);
-    userPlaceholder.textColor = [textColor colorWithAlphaComponent:0.5];
-
-    [self.user setFont:[UIFont systemFontOfSize:13]];
-    [self.user setDelegate:self];
-
-    // Password
-    _imagePassword.image = [[UIImage imageNamed:@"loginPassword"] imageWithColor:textColor size:50];
-    _password.textColor = textColor;
-    _password.tintColor = textColor;
-    _password.placeholder = NSLocalizedString(@"_password_", nil);
-    UILabel *passwordPlaceholder = object_getIvar(_password, ivar);
-    passwordPlaceholder.textColor = [textColor colorWithAlphaComponent:0.5];
-    [self.password setFont:[UIFont systemFontOfSize:13]];
-    [self.password setDelegate:self];
-
-    [self.toggleVisiblePassword setImage:[[UIImage imageNamed:@"visiblePassword"] imageWithColor:textColor size:25] forState:UIControlStateNormal];
-    
-    // Login
-    [self.login setTitle:NSLocalizedString(@"_login_", nil) forState:UIControlStateNormal] ;
-    self.login.backgroundColor = textColor;
-    self.login.tintColor = textColorOpponent;
-    self.login.layer.cornerRadius = 20;
-    self.login.clipsToBounds = YES;
-    
-    // Type view
-    [self.loginTypeView setTitle:NSLocalizedString(@"_traditional_login_", nil) forState:UIControlStateNormal];
-    [self.loginTypeView setTitleColor:[textColor colorWithAlphaComponent:0.5] forState:UIControlStateNormal];
-
-    // Brand
-    if ([NCBrandOptions shared].disable_request_login_url) {
-        _baseUrl.text = [NCBrandOptions shared].loginBaseUrl;
-        _imageBaseUrl.hidden = YES;
-        _baseUrl.hidden = YES;
-    }
-    
-    // QrCode image
-    [self.qrCode setImage:[[UIImage imageNamed:@"qrcode"] imageWithColor:textColor size:100] forState:UIControlStateNormal];
-    
-    NSArray *listAccount = [[NCManageDatabase shared] getAccounts];
-    if ([listAccount count] == 0) {
-        _imageUser.hidden = YES;
-        _user.hidden = YES;
-        _imagePassword.hidden = YES;
-        _password.hidden = YES;
-    } else {
-        _imageUser.hidden = YES;
-        _user.hidden = YES;
-        _imagePassword.hidden = YES;
-        _password.hidden = YES;
-        self.navigationItem.leftBarButtonItem = cancelButton;
-    }
-}
-
-- (void)viewDidAppear:(BOOL)animated
-{
-    [super viewDidAppear:animated];
-    
-    // Stop timer error network
-    [appDelegate.timerErrorNetworking invalidate];
-}
-
-- (void)viewDidDisappear:(BOOL)animated
-{
-    [super viewDidDisappear:animated];
-    
-    // Start timer
-    [appDelegate startTimerErrorNetworking];
-}
-
-- (BOOL)textFieldShouldReturn:(UITextField *)textField
-{
-    [textField resignFirstResponder];
-    return NO;
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark == Chech Server URL ==
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)testUrl
-{
-    self.login.enabled = NO;
-    [self.activity startAnimating];
-    
-    // Check whether baseUrl contain protocol. If not add https:// by default.
-    if(![self.baseUrl.text hasPrefix:@"https"] && ![self.baseUrl.text hasPrefix:@"http"]) {
-      self.baseUrl.text = [NSString stringWithFormat:@"https://%@",self.baseUrl.text];
-    }
-    
-    // Remove trailing slash
-    if ([self.baseUrl.text hasSuffix:@"/"])
-        self.baseUrl.text = [self.baseUrl.text substringToIndex:[self.baseUrl.text length] - 1];
-        
-    [[NCCommunication shared] getServerStatusWithServerUrl:self.baseUrl.text customUserAgent:nil addCustomHeaders:nil completionHandler:^(NSString *serverProductName, NSString *serverVersion, NSInteger versionMajor, NSInteger versionMinor, NSInteger versionMicro, BOOL extendedSupport, NSInteger errorCode, NSString *errorDescription) {
-        
-        if (errorCode == 0) {
-            
-            [self.activity stopAnimating];
-            self.login.enabled = YES;
-            
-            // Login Flow V2
-            [[NCCommunication shared] getLoginFlowV2WithServerUrl:self.baseUrl.text completionHandler:^(NSString *token, NSString *endpoint, NSString *login, NSInteger errorCode, NSString *errorDescription) {
-                
-                // Login Flow V2
-                if (errorCode == 0 && [[NCBrandOptions shared] use_loginflowv2] && token != nil && endpoint != nil && login != nil) {
-                    
-                    NCLoginWeb *activeLoginWeb = [[UIStoryboard storyboardWithName:@"CCLogin" bundle:nil] instantiateViewControllerWithIdentifier:@"NCLoginWeb"];
-                    
-                    activeLoginWeb.urlBase = self.baseUrl.text;
-                    activeLoginWeb.loginFlowV2Available = true;
-                    activeLoginWeb.loginFlowV2Token = token;
-                    activeLoginWeb.loginFlowV2Endpoint = endpoint;
-                    activeLoginWeb.loginFlowV2Login = login;
-                    
-                    [self.navigationController pushViewController:activeLoginWeb animated:true];
-                }
-                
-                // Login Flow
-                else if (_user.hidden && _password.hidden && versionMajor >= [[NCGlobal shared] nextcloudVersion12]) {
-                    
-                    NCLoginWeb *activeLoginWeb = [[UIStoryboard storyboardWithName:@"CCLogin" bundle:nil] instantiateViewControllerWithIdentifier:@"NCLoginWeb"];
-                    activeLoginWeb.urlBase = self.baseUrl.text;
-                    
-                    [self.navigationController pushViewController:activeLoginWeb animated:true];
-                }
-                
-                // NO Login Flow available
-                else if (versionMajor < [[NCGlobal shared] nextcloudVersion12]) {
-                    
-                    [self.loginTypeView setHidden:YES];
-                    
-                    _imageUser.hidden = NO;
-                    _user.hidden = NO;
-                    _imagePassword.hidden = NO;
-                    _password.hidden = NO;
-                    
-                    [_user becomeFirstResponder];
-                }
-            }];
-            
-        } else {
-            
-            [self.activity stopAnimating];
-            self.login.enabled = YES;
-            
-            if (errorCode == NSURLErrorServerCertificateUntrusted) {
-                
-                UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"_ssl_certificate_untrusted_", nil) message:NSLocalizedString(@"_connect_server_anyway_", nil)  preferredStyle:UIAlertControllerStyleAlert];
-                [alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"_yes_", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
-                    [[NCNetworking shared] writeCertificateWithDirectoryCertificate:[CCUtility getDirectoryCerificates]];
-                    [appDelegate startTimerErrorNetworking];
-                }]];
-                               
-                [alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"_no_", nil) style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
-                    [appDelegate startTimerErrorNetworking];
-                }]];
-                [self presentViewController:alertController animated:YES completion:^{
-                    // Stop timer error network
-                    [appDelegate.timerErrorNetworking invalidate];
-                }];
-                
-            } else {
-                
-                UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"_connection_error_", nil) message:errorDescription preferredStyle:UIAlertControllerStyleAlert];
-                UIAlertAction *okAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"_ok_", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {}];
-                
-                [alertController addAction:okAction];
-                [self presentViewController:alertController animated:YES completion:nil];
-            }
-        }
-        
-    }];
-}
-
-#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:textColor};
-    }
-}
-
--(void)textFieldDidEndEditing:(UITextField *)textField
-{
-    if (textField == self.password) {
-        self.toggleVisiblePassword.hidden = YES;
-        self.password.defaultTextAttributes = @{NSFontAttributeName: [UIFont systemFontOfSize:14.0f], NSForegroundColorAttributeName:textColor};
-    }
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark === NCLoginQRCodeDelegate ===
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)dismissQRCode:(NSString *)value metadataType:(NSString *)metadataType
-{
-    NSString *protocolLogin = [[NCBrandOptions shared].webLoginAutenticationProtocol stringByAppendingString:@"login/"];
-    
-    if (value != nil && [value hasPrefix:protocolLogin] && [value containsString:@"user:"] && [value containsString:@"password:"] && [value containsString:@"server:"]) {
-        
-        value = [value stringByReplacingOccurrencesOfString:protocolLogin withString:@""];
-        
-        NSArray *valueArray = [value componentsSeparatedByString: @"&"];
-        
-        if (valueArray.count == 3) {
-            
-            _imageUser.hidden = NO;
-            _user.hidden = NO;
-            _imagePassword.hidden = NO;
-            _password.hidden = NO;
-            
-            [self.loginTypeView setTitle:NSLocalizedString(@"_web_login_", nil) forState:UIControlStateNormal];
-            
-            self.user.text = [valueArray[0] stringByReplacingOccurrencesOfString:@"user:" withString:@""];
-            self.password.text = [valueArray[1] stringByReplacingOccurrencesOfString:@"password:" withString:@""];
-            self.baseUrl.text = [valueArray[2] stringByReplacingOccurrencesOfString:@"server:" withString:@""];
-            
-            // Check whether baseUrl contain protocol. If not add https:// by default.
-            if(![self.baseUrl.text hasPrefix:@"https"] && ![self.baseUrl.text hasPrefix:@"http"]) {
-                self.baseUrl.text = [NSString stringWithFormat:@"https://%@",self.baseUrl.text];
-            }
-            
-            NSString *url = self.baseUrl.text;
-            NSString *user = self.user.text;
-            NSString *token = self.password.text;
-            
-            self.login.enabled = NO;
-            [self.activity startAnimating];
-            
-            NSString *webDAV = [[NCUtilityFileSystem shared] getWebDAVWithAccount:appDelegate.account];
-            NSString *serverUrl = [NSString stringWithFormat:@"%@/%@", url, webDAV];
-            
-            [[NCCommunication shared] checkServerWithServerUrl:serverUrl completionHandler:^(NSInteger errorCode, NSString *errorDescription) {
-                
-                [self.activity stopAnimating];
-                self.login.enabled = YES;
-                
-                [self afterLoginWithUrl:url user:user token:token errorCode:errorCode message:errorDescription];
-            }];
-        }
-    }
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark == Login ==
-#pragma --------------------------------------------------------------------------------------------
-
-- (IBAction)handlebaseUrlchange:(id)sender
-{
-    if ([self.baseUrl.text length] > 0 && !_user.hidden && !_password.hidden)
-        [self performSelector:@selector(testUrl) withObject:nil];
-}
-
-- (IBAction)handleButtonLogin:(id)sender
-{
-    if ([self.baseUrl.text length] > 0 && _user.hidden && _password.hidden) {
-        [self testUrl];
-        return;
-    }
-    
-    if ([self.baseUrl.text length] > 0 && [self.user.text length] && [self.password.text length]) {
-        
-        // 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];
-        
-        NSString *url = self.baseUrl.text;
-        NSString *user = self.user.text;
-        NSString *password = self.password.text;
-        
-        self.login.enabled = NO;
-        [self.activity startAnimating];
-
-        [[NCCommunication shared] getAppPasswordWithServerUrl:url username:user password:password userAgent:nil completionHandler:^(NSString *token, NSInteger errorCode, NSString *errorDescription) {
-            
-            [self.activity stopAnimating];
-            self.login.enabled = YES;
-            
-            [self afterLoginWithUrl:url user:user token:token errorCode:errorCode message:errorDescription];
-        }];
-    }
-}
-
-- (void)afterLoginWithUrl:(NSString *)url user:(NSString *)user token:(NSString *)token errorCode:(NSInteger)errorCode message:(NSString *)message
-{
-    if (errorCode == 0) {
-        
-        NSString *account = [NSString stringWithFormat:@"%@ %@", user, url];
-        
-        // NO account found, clear
-        if ([NCManageDatabase.shared getAccounts] == nil) { [NCUtility.shared removeAllSettings]; }
-        
-        [[NCManageDatabase shared] deleteAccount:account];
-        [[NCManageDatabase shared] addAccount:account urlBase:url user:user password:token];
-        
-        tableAccount *tableAccount = [[NCManageDatabase shared] setAccountActive:account];
-        
-        // Setting appDelegate active account
-        [appDelegate settingAccount:tableAccount.account urlBase:tableAccount.urlBase user:tableAccount.user userId:tableAccount.userId password:[CCUtility getPassword:tableAccount.account]];
-        
-        if ([CCUtility getIntro]) {
-            [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:NCGlobal.shared.notificationCenterInitializeMain object:nil userInfo:nil];
-            [self dismissViewControllerAnimated:YES completion:nil];
-        } else {
-            [CCUtility setIntro:YES];
-            if (self.presentingViewController == nil) {
-                UIViewController *viewController = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateInitialViewController];
-                viewController.modalPresentationStyle = UIModalPresentationFullScreen;
-                [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:NCGlobal.shared.notificationCenterInitializeMain object:nil userInfo:nil];
-                appDelegate.window.rootViewController = viewController;
-                [appDelegate.window makeKeyWindow];
-            } else {
-                [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:NCGlobal.shared.notificationCenterInitializeMain object:nil userInfo:nil];
-                [self dismissViewControllerAnimated:YES completion:nil];
-            }
-        }
-    } else {
-        if (errorCode != NSURLErrorServerCertificateUntrusted) {
-            NSString *messageAlert = [NSString stringWithFormat:@"%@.\n%@", NSLocalizedString(@"_not_possible_connect_to_server_", nil), message];
-            UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"_error_", nil) message:messageAlert preferredStyle:UIAlertControllerStyleAlert];
-            UIAlertAction *okAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"_ok_", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {}];
-            [alertController addAction:okAction];
-            [self presentViewController:alertController animated:YES completion:nil];
-        }
-    }
-}
-
-- (IBAction)handleAnnulla:(id)sender
-{
-    [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: textColor};
-}
-
-- (IBAction)handleLoginTypeView:(id)sender
-{
-    if (_user.hidden && _password.hidden) {
-        
-        _imageUser.hidden = NO;
-        _user.hidden = NO;
-        _imagePassword.hidden = NO;
-        _password.hidden = NO;
-        
-        [self.loginTypeView setTitle:NSLocalizedString(@"_web_login_", nil) forState:UIControlStateNormal];
-        
-    } else {
-        
-        _imageUser.hidden = YES;
-        _user.hidden = YES;
-        _imagePassword.hidden = YES;
-        _password.hidden = YES;
-        
-        [self.loginTypeView setTitle:NSLocalizedString(@"_traditional_login_", nil) forState:UIControlStateNormal];
-    }
-}
-
-- (IBAction)handleQRCode:(id)sender
-{
-    NCLoginQRCode *qrCode = [[NCLoginQRCode alloc] initWithDelegate:self];
-    
-    [qrCode scan];
-}
-
-@end