[gnome-boxes/delete-auth-credentials: 18/18] machine, display: Cleanup credentials when auth failed



commit 8a88c9cd51a747ba5863091aa78110ebcadf3352
Author: Felipe Borges <felipeborges gnome org>
Date:   Thu May 3 12:58:26 2018 +0200

    machine, display: Cleanup credentials when auth failed
    
    We automatically store the display credentials in the keyring
    whenever they are inputed. We shouldn't keep them when the
    authentication proceedure fails.

 src/display.vala     | 1 +
 src/machine.vala     | 5 +++++
 src/vnc-display.vala | 2 ++
 3 files changed, 8 insertions(+)
---
diff --git a/src/display.vala b/src/display.vala
index 73b4e737..31fc1ed9 100644
--- a/src/display.vala
+++ b/src/display.vala
@@ -20,6 +20,7 @@
     public signal void hide (int display_id);
     public signal void disconnected (bool connection_failed);
     public signal void got_error (string message);
+    public signal void auth_failed ();
 
     public delegate int OpenFDFunc ();
 
diff --git a/src/machine.vala b/src/machine.vala
index 6ade6d28..8c2fd8ae 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -80,6 +80,7 @@
     private ulong need_username_id;
     private ulong ui_state_id;
     private ulong got_error_id;
+    private ulong auth_failed_id;
     private uint screenshot_id;
     public const int SCREENSHOT_WIDTH = 180;
     public const int SCREENSHOT_HEIGHT = 134;
@@ -191,6 +192,8 @@ protected void show_display () {
                 need_username_id = 0;
                 _display.disconnect (got_error_id);
                 got_error_id = 0;
+                _display.disconnect (auth_failed_id);
+                auth_failed_id = 0;
             }
 
             _display = value;
@@ -211,6 +214,8 @@ protected void show_display () {
                     got_error (message);
             });
 
+            auth_failed_id = _display.auth_failed.connect (() => { delete_auth_credentials (); });
+
             disconnected_id = _display.disconnected.connect ((failed) => {
                 message (@"display $name disconnected");
                 if (window == null) // App exitting & no window exists anymore
diff --git a/src/vnc-display.vala b/src/vnc-display.vala
index 2c37bd16..e0ea399f 100644
--- a/src/vnc-display.vala
+++ b/src/vnc-display.vala
@@ -43,6 +43,8 @@
 
             need_password = (password != null);
             need_username = (username != null);
+
+            auth_failed ();
         });
         display.vnc_auth_unsupported.connect (() => {
             debug ("auth unsupported");


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