[shotwell/shotwell-0.30] webauth: Clear local store of webkit



commit 8b163bdb2ea6efac353125c24cc97be167fc34cf
Author: Jens Georg <mail jensge org>
Date:   Fri May 22 11:36:19 2020 +0200

    webauth: Clear local store of webkit

 plugins/authenticator/shotwell/GoogleAuthenticator.vala |  4 +++-
 plugins/common/WebAuthenticationPane.vala               | 11 +++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)
---
diff --git a/plugins/authenticator/shotwell/GoogleAuthenticator.vala 
b/plugins/authenticator/shotwell/GoogleAuthenticator.vala
index 5b38ee66..a607cd06 100644
--- a/plugins/authenticator/shotwell/GoogleAuthenticator.vala
+++ b/plugins/authenticator/shotwell/GoogleAuthenticator.vala
@@ -371,6 +371,7 @@ namespace Publishing.Authenticator.Shotwell.Google {
             host.set_config_string("refresh_token", session.refresh_token);
 
             this.authenticated();
+            web_auth_pane.clear();
         }
 
 
@@ -387,7 +388,7 @@ namespace Publishing.Authenticator.Shotwell.Google {
             try {
                 txn.execute();
             } catch (Spit.Publishing.PublishingError err) {
-                    host.post_error(err);
+                host.post_error(err);
             }
         }
 
@@ -420,6 +421,7 @@ namespace Publishing.Authenticator.Shotwell.Google {
                 Idle.add (() => { this.authenticate(); return false; });
             }
 
+            web_auth_pane.clear();
             host.post_error(err);
         }
 
diff --git a/plugins/common/WebAuthenticationPane.vala b/plugins/common/WebAuthenticationPane.vala
index 342d0ccf..669e3395 100644
--- a/plugins/common/WebAuthenticationPane.vala
+++ b/plugins/common/WebAuthenticationPane.vala
@@ -18,6 +18,16 @@ namespace Shotwell.Plugins.Common {
         private Gtk.Widget widget;
         private Gtk.Entry entry;
 
+        public void clear() {
+            try {
+                debug("Clearing the data of WebKit...");
+                this.webview.get_website_data_manager().clear.begin(WebKit.WebsiteDataTypes.ALL, 
(GLib.TimeSpan)0);
+            } catch (Error e) {
+                // Do nothing
+                message("Failed to clear data: %s", e.message);
+            }
+        }
+
         public override void constructed () {
             base.constructed ();
 
@@ -116,6 +126,7 @@ namespace Shotwell.Plugins.Common {
         }
 
         public void on_pane_uninstalled() {
+            this.clear();
         }
    }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]