[Pkg-owncloud-commits] [owncloud-client] 50/70: Fix wizard flow with shibboleth

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat May 17 20:01:30 UTC 2014


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit de970eb0a50c8062768ad9e27f3740a5be730082
Author: Daniel Molkentin <danimo at owncloud.com>
Date:   Thu May 15 09:43:07 2014 +0200

    Fix wizard flow with shibboleth
---
 src/creds/shibboleth/shibbolethwebview.cpp | 12 +++++++++++-
 src/creds/shibboleth/shibbolethwebview.h   |  7 ++++++-
 src/creds/shibbolethcredentials.cpp        |  6 +++---
 src/creds/shibbolethcredentials.h          |  2 +-
 src/mirall/mirallaccessmanager.cpp         |  1 +
 src/wizard/owncloudshibbolethcredspage.cpp |  6 +++---
 src/wizard/owncloudshibbolethcredspage.h   |  2 +-
 7 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/src/creds/shibboleth/shibbolethwebview.cpp b/src/creds/shibboleth/shibbolethwebview.cpp
index 87cea0b..033d8dd 100644
--- a/src/creds/shibboleth/shibbolethwebview.cpp
+++ b/src/creds/shibboleth/shibbolethwebview.cpp
@@ -34,6 +34,7 @@ namespace Mirall
 ShibbolethWebView::ShibbolethWebView(Account* account, QWidget* parent)
     : QWebView(parent)
     , _account(account)
+    , _accepted(false)
 {
     // no minimize
     setWindowFlags(Qt::Dialog);
@@ -66,6 +67,7 @@ void ShibbolethWebView::onNewCookiesForUrl (const QList<QNetworkCookie>& cookieL
         QNetworkCookie shibCookie = ShibbolethCredentials::findShibCookie(_account, cookieList);
         if (shibCookie != QNetworkCookie()) {
             Q_EMIT shibbolethCookieReceived(shibCookie, _account);
+            accept();
             close();
         }
     }
@@ -73,7 +75,9 @@ void ShibbolethWebView::onNewCookiesForUrl (const QList<QNetworkCookie>& cookieL
 
 void ShibbolethWebView::closeEvent(QCloseEvent *event)
 {
-    Q_EMIT viewHidden();
+    if (!_accepted) {
+        Q_EMIT rejected();
+    }
     QWebView::closeEvent(event);
 }
 
@@ -113,4 +117,10 @@ void ShibbolethWebView::slotHandleAuthentication(QNetworkReply *reply, QAuthenti
     }
 }
 
+void ShibbolethWebView::accept()
+{
+    _accepted = true;
+    Q_EMIT accepted();
+}
+
 } // ns Mirall
diff --git a/src/creds/shibboleth/shibbolethwebview.h b/src/creds/shibboleth/shibbolethwebview.h
index eb0db63..fc96508 100644
--- a/src/creds/shibboleth/shibbolethwebview.h
+++ b/src/creds/shibboleth/shibbolethwebview.h
@@ -41,7 +41,8 @@ public:
 
 Q_SIGNALS:
   void shibbolethCookieReceived(const QNetworkCookie &cookie, Account *account);
-  void viewHidden();
+  void accepted();
+  void rejected();
 
 private Q_SLOTS:
   void onNewCookiesForUrl(const QList<QNetworkCookie>& cookieList, const QUrl& url);
@@ -49,9 +50,13 @@ private Q_SLOTS:
   void slotLoadFinished(bool success = true);
   void slotHandleAuthentication(QNetworkReply*,QAuthenticator*);
 
+protected:
+  void accept();
+
 private:
   void setup(Account *account, ShibbolethCookieJar* jar);
   QPointer<Account> _account;
+  bool _accepted;
 };
 
 } // ns Mirall
diff --git a/src/creds/shibbolethcredentials.cpp b/src/creds/shibbolethcredentials.cpp
index b074cd7..76cf057 100644
--- a/src/creds/shibbolethcredentials.cpp
+++ b/src/creds/shibbolethcredentials.cpp
@@ -261,7 +261,7 @@ void ShibbolethCredentials::slotUserFetched(const QString &user)
 }
 
 
-void ShibbolethCredentials::slotBrowserHidden()
+void ShibbolethCredentials::slotBrowserAccepted()
 {
     _ready = false;
     Q_EMIT fetched();
@@ -333,8 +333,8 @@ void ShibbolethCredentials::showLoginWindow(Account* account)
     _browser = new ShibbolethWebView(account);
     connect(_browser, SIGNAL(shibbolethCookieReceived(QNetworkCookie, Account*)),
             this, SLOT(onShibbolethCookieReceived(QNetworkCookie, Account*)));
-    connect(_browser, SIGNAL(viewHidden()),
-            this, SLOT(slotBrowserHidden()));
+    connect(_browser, SIGNAL(accepted()),
+            this, SLOT(slotBrowserAccepted()));
     // FIXME If the browser was hidden (e.g. user closed it) without us logging in, the logic gets stuck
     // and can only be unstuck by restarting the app or pressing "Sign in" (we should switch to offline but we don't)
 
diff --git a/src/creds/shibbolethcredentials.h b/src/creds/shibbolethcredentials.h
index a8d5d72..5bcd244 100644
--- a/src/creds/shibbolethcredentials.h
+++ b/src/creds/shibbolethcredentials.h
@@ -61,7 +61,7 @@ public Q_SLOTS:
 
 private Q_SLOTS:
     void onShibbolethCookieReceived(const QNetworkCookie&, Account*);
-    void slotBrowserHidden();
+    void slotBrowserAccepted();
     void onFetched();
     void slotReadJobDone(QKeychain::Job*);
     void slotInvalidateAndFetchInvalidateDone(QKeychain::Job*);
diff --git a/src/mirall/mirallaccessmanager.cpp b/src/mirall/mirallaccessmanager.cpp
index e372e6e..ddb9be0 100644
--- a/src/mirall/mirallaccessmanager.cpp
+++ b/src/mirall/mirallaccessmanager.cpp
@@ -14,6 +14,7 @@
 #include <QNetworkRequest>
 #include <QNetworkProxy>
 #include <QAuthenticator>
+#include <QSslConfiguration>
 
 #include "mirall/cookiejar.h"
 #include "mirall/mirallaccessmanager.h"
diff --git a/src/wizard/owncloudshibbolethcredspage.cpp b/src/wizard/owncloudshibbolethcredspage.cpp
index 10d8639..a6b11eb 100644
--- a/src/wizard/owncloudshibbolethcredspage.cpp
+++ b/src/wizard/owncloudshibbolethcredspage.cpp
@@ -38,8 +38,8 @@ void OwncloudShibbolethCredsPage::setupBrowser()
     _browser = new ShibbolethWebView(ocWizard->account());
     connect(_browser, SIGNAL(shibbolethCookieReceived(const QNetworkCookie&, Account*)),
             this, SLOT(slotShibbolethCookieReceived()));
-    connect(_browser, SIGNAL(viewHidden()),
-            this, SLOT(slotViewHidden()));
+    connect(_browser, SIGNAL(rejected()),
+            this, SLOT(slotBrowserRejected()));
 
     _browser->move(ocWizard->x(), ocWizard->y());
     _browser->show();
@@ -89,7 +89,7 @@ void OwncloudShibbolethCredsPage::slotShibbolethCookieReceived()
     emit connectToOCUrl(field("OCUrl").toString().simplified());
 }
 
-void OwncloudShibbolethCredsPage::slotViewHidden()
+void OwncloudShibbolethCredsPage::slotBrowserRejected()
 {
     wizard()->back();
     wizard()->show();
diff --git a/src/wizard/owncloudshibbolethcredspage.h b/src/wizard/owncloudshibbolethcredspage.h
index 7b2e8be..a9db292 100644
--- a/src/wizard/owncloudshibbolethcredspage.h
+++ b/src/wizard/owncloudshibbolethcredspage.h
@@ -47,7 +47,7 @@ public Q_SLOTS:
 
 private Q_SLOTS:
   void slotShibbolethCookieReceived();
-  void slotViewHidden();
+  void slotBrowserRejected();
 
 private:
   void setupBrowser();

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list