瀏覽代碼

fix login flow

Marino Faggiana 7 年之前
父節點
當前提交
3b9081a006
共有 3 個文件被更改,包括 11 次插入7 次删除
  1. 3 2
      iOSClient/AppDelegate.m
  2. 0 2
      iOSClient/Login/CCLogin.m
  3. 8 3
      iOSClient/Login/CCLoginWeb.swift

+ 3 - 2
iOSClient/AppDelegate.m

@@ -346,7 +346,7 @@
     
     @synchronized (self) {
 
-        // only for personalized LoginWeb
+        // only for personalized LoginWeb [customer]
         if ([NCBrandOptions sharedInstance].use_login_web_personalized) {
             
             if (_activeLoginWeb == nil) {
@@ -354,6 +354,7 @@
                 _activeLoginWeb = [CCLoginWeb new];
                 _activeLoginWeb.delegate = delegate;
                 _activeLoginWeb.loginType = loginType;
+                _activeLoginWeb.urlBase = [[NCBrandOptions sharedInstance] loginBaseUrl];
                 
                 dispatch_async(dispatch_get_main_queue(), ^ {
                     [_activeLoginWeb presentModalWithDefaultTheme:delegate];
@@ -379,7 +380,7 @@
                 _activeLoginWeb = [CCLoginWeb new];
                 _activeLoginWeb.delegate = delegate;
                 _activeLoginWeb.loginType = loginType;
-                _activeLoginWeb.urlBase = [self.activeUrl stringByAppendingString:flowEndpoint];
+                _activeLoginWeb.urlBase = self.activeUrl;
 
                 dispatch_async(dispatch_get_main_queue(), ^ {
                     [_activeLoginWeb presentModalWithDefaultTheme:delegate];

+ 0 - 2
iOSClient/Login/CCLogin.m

@@ -212,8 +212,6 @@
         // Remove trailing slash
         if ([self.baseUrl.text hasSuffix:@"/"])
             urlBase = [self.baseUrl.text substringToIndex:[self.baseUrl.text length] - 1];
-        // Add end point flow
-        urlBase = [urlBase stringByAppendingString:flowEndpoint];
         
         NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:urlBase] cachePolicy:0 timeoutInterval:20.0];
         [request addValue:[CCUtility getUserAgent] forHTTPHeaderField:@"User-Agent"];

+ 8 - 3
iOSClient/Login/CCLoginWeb.swift

@@ -25,7 +25,7 @@ public class CCLoginWeb: UIViewController {
     
     @objc weak var delegate: CCLoginDelegateWeb?
     @objc var loginType = loginAdd
-    @objc var urlBase = NCBrandOptions.sharedInstance.loginBaseUrl
+    @objc var urlBase = ""
     
     var viewController : UIViewController?
     let appDelegate = UIApplication.shared.delegate as! AppDelegate
@@ -33,13 +33,18 @@ public class CCLoginWeb: UIViewController {
     
     @objc func presentModalWithDefaultTheme(_ vc: UIViewController) {
         
+        var urlString = urlBase
         self.viewController = vc
         
         if (loginType == loginAdd || loginType == loginModifyPasswordUser) {
             doneButtonVisible = true
         }
         
-        let webVC = SwiftModalWebVC(urlString: urlBase, theme: .custom, color: NCBrandColor.sharedInstance.customer, colorText: NCBrandColor.sharedInstance.customerText, doneButtonVisible: doneButtonVisible, hideToolbar: true)
+        if (NCBrandOptions.sharedInstance.use_login_web_personalized == false) {
+            urlString =  urlBase+flowEndpoint
+        }
+        
+        let webVC = SwiftModalWebVC(urlString: urlString, theme: .custom, color: NCBrandColor.sharedInstance.customer, colorText: NCBrandColor.sharedInstance.customerText, doneButtonVisible: doneButtonVisible, hideToolbar: true)
         webVC.delegateWeb = self
 
         vc.present(webVC, animated: false, completion: nil)
@@ -67,7 +72,7 @@ extension CCLoginWeb: SwiftModalWebVCDelegate {
                     
                     // Login Flow NC 12
                     if (NCBrandOptions.sharedInstance.use_login_web_personalized == false && serverUrl.hasPrefix("http://") == false && serverUrl.hasPrefix("https://") == false) {
-                        serverUrl = urlBase.replacingOccurrences(of: flowEndpoint, with: "")
+                        serverUrl = urlBase
                     }
                     
                     if (serverUrl.last == "/") {