mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/virt-viewer
synced 2025-12-27 06:23:42 +00:00
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.
This commit is contained in:
parent
e825e183a1
commit
276ca0f753
@ -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,
|
||||
|
||||
@ -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>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user