summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabiano FidĂȘncio <fidencio@redhat.com>2014-09-15 16:09:52 +0200
committerFabiano FidĂȘncio <fidencio@redhat.com>2014-09-17 13:45:46 +0200
commit276ca0f7537cbf4ba77d42e53286e8c19fb076c2 (patch)
treee85fe3b70f976bc3fea1fd334154121940cd3240
parente825e183a1b8087f9576dffff3461ef7bda89c0c (diff)
downloadvirt-viewer-276ca0f7537cbf4ba77d42e53286e8c19fb076c2.tar.gz
virt-viewer-276ca0f7537cbf4ba77d42e53286e8c19fb076c2.tar.xz
virt-viewer-276ca0f7537cbf4ba77d42e53286e8c19fb076c2.zip
Add support to view the password entry content
Allow users to check if the entered password is right and/org modify the password easily in case it's wrong.
-rw-r--r--src/virt-viewer-auth.c10
-rw-r--r--src/virt-viewer-auth.xml14
2 files changed, 24 insertions, 0 deletions
diff --git a/src/virt-viewer-auth.c b/src/virt-viewer-auth.c
index 230d720..d08f2c0 100644
--- a/src/virt-viewer-auth.c
+++ b/src/virt-viewer-auth.c
@@ -32,6 +32,12 @@
#include "virt-viewer-auth.h"
+static void
+show_password(GtkCheckButton *check_button G_GNUC_UNUSED,
+ GtkEntry *entry)
+{
+ gtk_entry_set_visibility(entry, !gtk_entry_get_visibility(entry));
+}
/* NOTE: if username is provided, and *username is non-NULL, the user input
* field will be pre-filled with this value. The existing string will be freed
@@ -51,6 +57,7 @@ virt_viewer_auth_collect_credentials(GtkWindow *window,
GtkWidget *promptUsername;
GtkWidget *promptPassword;
GtkWidget *labelMessage;
+ GtkWidget *checkPassword;
int response;
char *message;
@@ -63,6 +70,7 @@ virt_viewer_auth_collect_credentials(GtkWindow *window,
promptUsername = GTK_WIDGET(gtk_builder_get_object(creds, "prompt-username"));
credPassword = GTK_WIDGET(gtk_builder_get_object(creds, "cred-password"));
promptPassword = GTK_WIDGET(gtk_builder_get_object(creds, "prompt-password"));
+ checkPassword = GTK_WIDGET(gtk_builder_get_object(creds, "show-password"));
gtk_widget_set_sensitive(credUsername, username != NULL);
if (username && *username) {
@@ -74,6 +82,8 @@ virt_viewer_auth_collect_credentials(GtkWindow *window,
gtk_widget_set_sensitive(credPassword, password != NULL);
gtk_widget_set_sensitive(promptPassword, password != NULL);
+ g_signal_connect(checkPassword, "clicked", G_CALLBACK(show_password), credPassword);
+
if (address) {
message = g_strdup_printf(_("Authentication is required for the %s connection to:\n\n<b>%s</b>\n\n"),
type,
diff --git a/src/virt-viewer-auth.xml b/src/virt-viewer-auth.xml
index 0da1181..d307754 100644
--- a/src/virt-viewer-auth.xml
+++ b/src/virt-viewer-auth.xml
@@ -129,6 +129,20 @@
<property name="bottom_attach">2</property>
</packing>
</child>
+ <child>
+ <object class="GtkCheckButton" id="show-password">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="active">False</property>
+ <property name="label" translatable="yes">Show password</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>