Skip to content
This repository has been archived by the owner on Jun 19, 2023. It is now read-only.

Commit

Permalink
firts changes to avoid duplicated sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
Pablo Carrascal authored and nasli committed Dec 12, 2017
1 parent e546181 commit 77ae765
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions Owncloud iOs Client/Login/Login/WebLoginViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ import Foundation
}

func closeLoginViewController() {
// UtilsFramework.deleteAllCookies()
let app: AppDelegate = (UIApplication.shared.delegate as! AppDelegate)

if app.activeUser != nil {
UtilsCookies.deleteCurrentSystemCookieStorageAndRestoreTheCookiesOfActiveUser()
}
self.performSegue(withIdentifier: K.unwindId.unwindToMainLoginView, sender: self)
}

Expand All @@ -51,11 +57,15 @@ import Foundation
super.viewDidLoad()
self.webViewLogin.delegate = self
self.webViewLogin.backgroundColor = UIColor.ofWebViewBackground()

let app: AppDelegate = (UIApplication.shared.delegate as! AppDelegate)
// Do any additional setup after loading the view.


if let user = app.activeUser {
UtilsCookies.setOnDBStorageCookiesByUser(user)
}

//load login url in web view
let app: AppDelegate = (UIApplication.shared.delegate as! AppDelegate)

self.oAuth2Manager.trustedCertificatesStore = self.sslCertificateManager
let urlToGetAuthCode = self.oAuth2Manager.getOAuth2URLToGetAuthCode(by: app.oauth2Configuration, withServerPath: serverPath)
self.loadWebViewWith(url: urlToGetAuthCode!)
Expand All @@ -76,7 +86,6 @@ import Foundation
self.webViewLogin.loadRequest(request)
}


// MARK: webView delegates

func webViewDidStartLoad(_ webView: UIWebView) {
Expand Down Expand Up @@ -114,6 +123,7 @@ import Foundation
if urlToFollow.hasPrefix(k_oauth2_redirect_uri){
processFinalRedirect(urlToFollow);
self.loadInterrupted = true;

return false; // will trigger webView(webView, didFailLoadWithError), with error due to cancellation

} else if urlToFollow.hasPrefix(serverPath + k_url_path_list_of_files_in_web) {
Expand Down

0 comments on commit 77ae765

Please sign in to comment.