[Pkg-owncloud-commits] [owncloud-client] 63/83: Clear all cookies when loging out

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat May 31 11:31:44 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 dd1152dd4febbd39fbe24f7297d9e892c729daaf
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Wed May 28 11:41:06 2014 +0200

    Clear all cookies when loging out
---
 src/creds/shibbolethcredentials.cpp | 13 ++-----------
 src/creds/shibbolethcredentials.h   |  1 -
 src/mirall/cookiejar.cpp            |  6 ++++++
 src/mirall/cookiejar.h              |  1 +
 4 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/src/creds/shibbolethcredentials.cpp b/src/creds/shibbolethcredentials.cpp
index 7efc92e..d6ac7fa 100644
--- a/src/creds/shibbolethcredentials.cpp
+++ b/src/creds/shibbolethcredentials.cpp
@@ -214,10 +214,8 @@ void ShibbolethCredentials::persist(Account* account)
 // only used by Application::slotLogout(). Use invalidateAndFetch for normal usage
 void ShibbolethCredentials::invalidateToken(Account *account)
 {
-    Q_UNUSED(account)
-    if (!removeFromCookieJar(_shibCookie)) {
-        qDebug() << "invalidateToken() called but no shibCookie in in cookie jar!";
-    }
+    CookieJar *jar = static_cast<CookieJar*>(account->networkAccessManager()->cookieJar());
+    jar->clearCookies();
     removeShibCookie(account);
     _shibCookie = QNetworkCookie();
     // ### access to ctx missing, but might not be required at all
@@ -400,12 +398,5 @@ void ShibbolethCredentials::addToCookieJar(const QNetworkCookie &cookie)
     jar->blockSignals(false);
 }
 
-bool ShibbolethCredentials::removeFromCookieJar(const QNetworkCookie &cookie)
-{
-    Account *account = AccountManager::instance()->account();
-    CookieJar *jar = qobject_cast<CookieJar*>(account->networkAccessManager()->cookieJar());
-    return jar->deleteCookie(cookie);
-}
-
 
 } // ns Mirall
diff --git a/src/creds/shibbolethcredentials.h b/src/creds/shibbolethcredentials.h
index 53c8af5..19a435c 100644
--- a/src/creds/shibbolethcredentials.h
+++ b/src/creds/shibbolethcredentials.h
@@ -77,7 +77,6 @@ private:
     void storeShibCookie(const QNetworkCookie &cookie, Account *account);
     void removeShibCookie(Account *account);
     void addToCookieJar(const QNetworkCookie &cookie);
-    bool removeFromCookieJar(const QNetworkCookie &cookie);
     QUrl _url;
     QByteArray prepareCookieData() const;
 
diff --git a/src/mirall/cookiejar.cpp b/src/mirall/cookiejar.cpp
index 0075608..19a0cf2 100644
--- a/src/mirall/cookiejar.cpp
+++ b/src/mirall/cookiejar.cpp
@@ -106,6 +106,12 @@ bool CookieJar::deleteCookie(const QNetworkCookie &delCookie)
     return removeSucceeded;
 }
 
+void CookieJar::clearCookies()
+{
+    setAllCookies(QList<QNetworkCookie>());
+}
+
+
 void CookieJar::save()
 {
     QFile file;
diff --git a/src/mirall/cookiejar.h b/src/mirall/cookiejar.h
index 16821ee..818f67a 100644
--- a/src/mirall/cookiejar.h
+++ b/src/mirall/cookiejar.h
@@ -30,6 +30,7 @@ public:
     QList<QNetworkCookie> cookiesForUrl(const QUrl &url) const;
 
     virtual bool deleteCookie(const QNetworkCookie & cookie);
+    void clearCookies();
 
 signals:
     void newCookiesForUrl(const QList<QNetworkCookie>& cookieList, const QUrl& url);

-- 
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