[gnome-boxes/delete-auth-credentials: 17/18] machine: Delete stored credentials when deleting



commit 9df445b58d0ab51a301d71cebd72a172d0e015b5
Author: Felipe Borges <felipeborges gnome org>
Date:   Wed May 2 16:52:27 2018 +0200

    machine: Delete stored credentials when deleting
    
    Delete the Machine credentials stored in the keyring when the
    machine gets deleted.

 src/machine.vala        | 7 +++++++
 src/remote-machine.vala | 2 ++
 2 files changed, 9 insertions(+)
---
diff --git a/src/machine.vala b/src/machine.vala
index 46d12b1f..6ade6d28 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -570,6 +570,8 @@ public virtual void delete (bool by_user = true) {
             ui_state_id = 0;
         }
 
+        delete_auth_credentials ();
+
         config.delete ();
         try {
             FileUtils.unlink (get_screenshot_filename ());
@@ -742,6 +744,11 @@ private void handle_auth () {
         }, "gnome-boxes-machine-uuid", config.uuid);
     }
 
+    private async void delete_auth_credentials () {
+        yield Secret.password_clear (secret_auth_schema, null,
+                                    "gnome-boxes-machine-uuid", config.uuid);
+    }
+
     public override int compare (CollectionItem other) {
         if (other is Machine)
             return config.compare ((other as Machine).config);
diff --git a/src/remote-machine.vala b/src/remote-machine.vala
index 3a3fdde8..0c07e9da 100644
--- a/src/remote-machine.vala
+++ b/src/remote-machine.vala
@@ -96,6 +96,8 @@ public override async void connect_display (Machine.ConnectFlags flags) throws G
     public override void delete (bool by_user = true) {
         return_if_fail (by_user);
 
+        base.delete ();
+
         source.delete ();
     }
 


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